Questions tagged [sandwich]

Sandwich, or sandwich variance estimation, refers to a method of estimating standard errors from estimating equations that is robust to many model based assumptions. The preferred tag is "robust-standard-error"

Sandwich variance estimation is a method of variance estimation in which parameters are defined as the roots to estimating equations. In likelihood based inference, estimating equations are called score equations (given by the derivative-log likelihood); in econometrics, moment conditions.

One can show by way of multivariable calculus that parameter estimation using estimating equations is consistent and has a variance of the form of a sandwich in which the "meat" of the sandwich is the empirical variance estimates of the score equations, with the Jacobian and its transpose as two slices of "bread". All of this is set up in Huber (1967) paper, and the various version of robust standard errors (GEE, White heteroskedasticity-corrected standard errors in cross-sectional econometrics, Newey-West variance estimates in time series, linearized variance estimates in survey statistics, Satorra-Bentler standard errors in structural equation modeling, etc.) are special forms.

Inference with sandwich estimates is semi-parametric in nature. The way the model contributes to them is (1) by providing the estimating/score equations, and (2) by providing the "bread" of the sandwich. Robustness properties of sandwich estimates stem from the second moments being taken with respect to the data, not with respect to the assumed model, although in most situations, the statistician needs to make a judgement call as to which units can be assumed (approximately) independent and can enter the relevant summations (e.g., what the clusters are for the clustered standard errors, or at what lag length autocorrelations drops to zero for Newey-West standard errors).

If all of the model assumptions hold, the model based estimates of standard errors (e.g., those based on inverse Hessian in the likelihood context) are efficient than sandwich based estimates, but these assumptions may be untestable, and/or could easily be found to be in violation for very large samples.

Sandwich variance estimation is, by default, the variance estimate of parameters estimated from Generalized Estimating Equations (GEE).

For most sandwich variance estimators, there is an asymptotically equivalent bootstrap method available.

Implementations:

Related topics:

39 questions
11
votes
2 answers

Robust regression inference and Sandwich estimators

Can you give me an example of the use of sandwich estimators in order to perform robust regression inference? I can see the example in ?sandwich, but I don't quite understand how we can go from lm(a ~ b, data) (r-coded) to an estimate and a p value…
Remi.b
  • 4,572
  • 12
  • 34
  • 64
6
votes
1 answer

Pairwise comparisons for a regression with sandwich estimates (in R)

The question in short I run a regression in R and made a boxplot of the response variable with grouping by one of the predictor variables. On this boxplot I'd like to add some information about the statistical model. What information (and how to…
Remi.b
  • 4,572
  • 12
  • 34
  • 64
5
votes
1 answer

Standard Errors with Weighted Least Squares Regression

For OLS, $\hat{\beta} = (X'X)^{-1}X'y$, and $\text{var}(\hat{\beta}) = (X'X)^{-1} X' \sigma^2 I X (X'X)^{-1}$. I can reproduce these "by hand". For WLS, with heteroskedastic errors and weights in diagonal $W$, $\hat{\beta} = (X'WX)^{-1}X'Wy$,…
bsbk
  • 1,127
  • 11
  • 19
5
votes
1 answer

Difference between Quasi-Poisson and Sandwich Covariance

I understand that both methods can be utilized to obtain correct inference in overdispersed Poisson data. What I don't understand is the difference between them: why the analyst would choose one over the other, how they are estimated, and how it…
4
votes
1 answer

Robust Residual standard error (in R)

I have a question regarding to the concept of robust standard errors. What I found about that topic is, that one can estimate the robust standard error for regression coefficients to eliminate problems with heteroscedasticity (when one wants to…
4
votes
1 answer

How to implement the sandwich estimator in a semi-parametric situation?

I am trying to implement a sandwich estimator described in Zhang et al. (2012, p. 1012) in very brief terms. The information they give is not enough for me to understand what has been actually done, which is why I re-produce the problem here in…
tomka
  • 5,874
  • 3
  • 30
  • 71
4
votes
0 answers

Sandwich Estimator in Maximum Likelihood Estimation of Logit

I am estimating a discrete choice model using mixed logit using Halton Draws. So everything is effectively done with MCMC. The code is written in MATLAB. I am using MATLAB's fminunc to do unconstrained maximization to maximize Total Likelihood of…
3
votes
1 answer

Robust OLS versus ML with sandwich estimator

If you compare the standard errors of the OLS coefficients with the White correction, versus the ML estimates with the variance estimated with the sandwich estimator, which standard errors do you expect to be the biggest? And is it correct that both…
Kasper
  • 3,059
  • 2
  • 22
  • 37
3
votes
0 answers

r quantreg - quantile regression with clustered standard errors

I fit a quantile regression using quantreg:::rq on clustered data. I use the Huber sandwich estimator to obtain cluster-corrected standard errors, which is indicated by the se = 'nid' argument in summary.rq. But here's my confusion: q_1 <- rq(y ~ y,…
3
votes
1 answer

How to calculate sandwich standard errors for generalized least squares models?

Dependent data can be modeled using covariance structures like compound symmetry, spherical, AR-1, and other. Using generalized least squares, inference can be made on the regression coefficients using model based standard errors. While the…
3
votes
1 answer

Clustered (grouped) standard errors MLE in R

I'm doing the following maximum likelihood estimation using mle2 function from bbmle package: library(bbmle) llik.probit2<- function(aL,beta, Ks, Kw, Bs, Bw, dta){ Y <- as.matrix(dta$qualified) sce1 <- as.matrix(dta$eds) wce1 <-…
2
votes
0 answers

Do robust standard errors protect you from proportional odds assumptions?

Cox Proportional Hazards models are traditionally taught alongside proportional hazards assumptions. There is a corresponding test of proportionality. However, if standard errors are calculated from sandwich estimators, there's no need to worry…
AdamO
  • 52,330
  • 5
  • 104
  • 209
2
votes
1 answer

How to compute the sandwich variance ML estimator in R

I'm currently estimating a DCC-type model by maximum likelihood. Im using the command solnp and it return an object where I can compute the Hessian H evaluated at the optimal values. If I want to find the covariance matrix of the estimators,…
2
votes
1 answer

Variance Estimation for Least Squares with Probability Weights

I'm running a simulation study and finding that the nominal SEs of the estimated coefficients when using weights in lm in R are an underestimate of the simulation SE. I have confirmed that $\hat{\beta}$ is estimated correctly. I believe that this is…
2
votes
0 answers

Calculating sandwich estimator

Considering design matrix $X \in \mathbb{R}^{n\times p}$ $(n>p)$ and response $y\in \mathbb{R}^{n}$. The sandwich estimator can be calculated directly using $$(X^TX)^{-1}X^T diag(r^2) X (X^TX)^{-1}$$ where $r$ is the residuals. The sandwich…
1
2 3