VerifiedEvidence: highv1.0.0

Sandwich Estimator

A method calculating an estimator's variance that remains valid even when standard model assumptions are violated, forming the basis of robust standard errors.

Last reviewedDarrin Baines IP Ltd

Concept Architecture

Concept


Theoretically, Sandwich Estimator is a covariance matrix estimator used to obtain standard errors that remain asymptotically valid under certain forms of model misspecification. It is called a sandwich estimator because its mathematical structure consists of a central empirical variability matrix placed between two inverse information or design matrices. The method exists to improve statistical inference when conventional variance assumptions, such as homoscedasticity or correctly specified within-cluster correlation, are not satisfied.

Mathematically, the Sandwich Estimator combines a model-based sensitivity matrix with an empirical variability matrix derived from residuals or estimating functions. In ordinary least squares, it produces heteroscedasticity-consistent covariance estimates. In clustered, longitudinal, and generalised estimating equation models, it accounts for correlation within clusters while assuming independence between clusters. The resulting coefficient estimates are unchanged, but their estimated variances, standard errors, confidence intervals, and hypothesis tests are adjusted.

In practice, the Sandwich Estimator is calculated using fitted-model residuals or cluster-level score contributions and is implemented in statistical software through robust or cluster-robust variance options. In health economics it is used in cost regressions, generalised linear models, clustered clinical trials, repeated-measures analyses, observational studies, and healthcare utilisation models where heteroscedasticity or within-cluster dependence may invalidate conventional standard errors.

Purpose


Used to estimate robust covariance matrices and standard errors when conventional distributional, variance, or correlation assumptions may be violated, thereby supporting valid confidence intervals and hypothesis tests in health economic analyses.

Mathematical Formulae

Primary Formula

V?? = A??BA??

where:

  • V?? = estimated sandwich covariance matrix
  • A = sensitivity or model-based information matrix
  • B = empirical variability matrix

Supporting Formulae

For ordinary least squares:

V?HC0(??) = (X?X)??X?diag(e?�, e?�, ?, e?�)X(X?X)??

For cluster-robust covariance estimation:

V?CR(??) = (X?X)???Xg?egeg?Xg??

Robust standard error:

SE?(???) = �V????

Wald statistic:

W = (??? ? ???)� � V????

Related Mathematical Methods

  • Robust Standard Error
  • Huber?White Estimator
  • Cluster-Robust Standard Error
  • Generalised Estimating Equations
  • Ordinary Least Squares
  • Maximum Likelihood Estimation
  • Wald Test
  • Heteroscedasticity-Consistent Covariance Estimation

Example

A health economist estimates the effect of a care-management programme on annual healthcare costs using patient-level data from 30 hospitals.

Estimated treatment coefficient:

?? = ?�1,400

Conventional standard error:

�420

Cluster-robust sandwich standard error:

�610

The robust Wald statistic is:

W = (?1,400)� � 610�

W = 5.27

The corresponding two-sided test indicates that the treatment effect remains statistically distinguishable from zero, although the larger sandwich standard error reflects correlation among patients treated within the same hospital.


Excel Implementation

FunctionExample FormulaHealth Economics Application
MMULT=MMULT(MatrixA,MatrixB)Perform matrix multiplication required for sandwich covariance estimation.
MINVERSE=MINVERSE(XTXRange)Calculate the inverse design or information matrix.
TRANSPOSE=TRANSPOSE(XRange)Construct transposed design matrices used in covariance calculations.
SUMPRODUCT=SUMPRODUCT(ResidualRange^2,WeightRange)Calculate empirical residual-based components of the central variability matrix.
SQRT=SQRT(VarianceCell)Convert robust coefficient variances into standard errors.

VBA (Optional)

Automate construction of heteroscedasticity-consistent or cluster-robust sandwich covariance matrices for health economic regression models.


Sources

  • Huber PJ. The Behaviour of Maximum Likelihood Estimates under Nonstandard Conditions. Proceedings of the Fifth Berkeley Symposium on Mathematical Statistics and Probability. 1967.
  • White H. A Heteroskedasticity-Consistent Covariance Matrix Estimator and a Direct Test for Heteroskedasticity. Econometrica. 1980.
  • Liang KY, Zeger SL. Longitudinal Data Analysis Using Generalized Linear Models. Biometrika. 1986.
  • Arellano M. Computing Robust Standard Errors for Within-Groups Estimators. Oxford Bulletin of Economics and Statistics. 1987.
  • Cameron AC, Miller DL. A Practitioner's Guide to Cluster-Robust Inference. Journal of Human Resources. 2015.
  • Briggs A, Claxton K, Sculpher M. Decision Modelling for Health Economic Evaluation.
  • Drummond MF, Sculpher MJ, Claxton K, Stoddart GL, Torrance GW. Methods for the Economic Evaluation of Health Care Programmes.

Library

Publications

1
  • Book

    Statistical Analysis of Cost-Effectiveness Data — Willan & Briggs, 1st Edition ed., 2006 (John Wiley & Sons)

    A synthesis of statistical methods for analysing cost-effectiveness data, including net-benefit regression, confidence intervals for the ICER, cost-effectiveness acceptability curves, and covariate adjustment. Part of the Wiley Statistics in Practice series.

Frequently Asked Questions (6)

  • What is the sandwich estimator?

    A method calculating an estimator's variance that remains valid even when standard model assumptions are violated, forming the basis of robust standard errors.

    Source: White 1980

  • How does the sandwich estimator get its name and its validity?

    The sandwich estimator calculates the variance of an estimator in a way that stays valid even when the model's assumptions are violated, and it takes its name from its mathematical form, in which a central term is flanked by two identical outer terms like the filling between slices of bread. By building the variance from the observed data rather than from an assumed model structure, it tolerates misspecification such as unequal error variance or correlation. It provides the machinery behind standard errors that stay valid when assumptions fail. Estimating variance that survives broken assumptions is its role. Kirkwood and Sterne (2003) describe this.

    Source: Kirkwood & Sterne 2003

  • How does the sandwich estimator work?

    The sandwich estimator works by combining the model-based information with the observed variability of the estimating function, or residuals, in a form where an empirical central term is surrounded by two model-based terms, so that the resulting variance estimate does not rely on the usual assumption of a correctly specified variance. So the sandwich estimator works by using the empirical variability rather than the assumed variance structure in the middle of its formula, which makes it robust to certain violations, and this is why it yields valid standard errors under heteroscedasticity and some forms of misspecification, providing the robust standard errors used when the standard assumptions are doubtful.

    Source: White 1980

  • Why is the sandwich estimator used?

    The sandwich estimator is used because it gives valid variance estimates, and hence valid standard errors and tests, when the standard assumptions about the error variance are violated, such as under heteroscedasticity or in clustered data, where ordinary variance estimates would be incorrect. So the sandwich estimator is used to obtain robust inference under weaker assumptions, which is valuable when the variance structure is uncertain or non-constant, and it underlies the robust standard errors and the variance estimation in methods such as generalised estimating equations, allowing valid conclusions without requiring the variance to be correctly modelled.

    Source: White 1980

  • How does the sandwich estimator relate to robust standard errors?

    The sandwich estimator relates to robust standard errors as the method that produces them: robust standard errors are the square roots of the variance estimates obtained from the sandwich estimator, so the sandwich estimator is the underlying technique and robust standard errors its practical output. So the sandwich estimator and robust standard errors are directly connected, with the sandwich estimator providing the variance estimate that is valid under weaker assumptions and the robust standard errors being derived from it for use in confidence intervals and tests, which is why robust standard errors are often described as sandwich standard errors.

    Source: White 1980

  • Where is the sandwich estimator applied?

    The sandwich estimator is applied in regression to obtain robust standard errors under heteroscedasticity; in the analysis of clustered or correlated data, where it underlies the variance estimation of generalised estimating equations; and more generally wherever valid variance estimates are needed despite possible misspecification of the variance structure. So the sandwich estimator is applied across settings requiring robust inference, from ordinary regression with non-constant variance to clustered data and generalised estimating equations, which is why it is a widely used tool for obtaining valid standard errors when the standard variance assumptions cannot be relied upon.

    Source: White 1980

Trust Record

Verified by Dr Darrin Baines

British health economist

Professional identity: darrinbaines.org

Verification date: 24 Dec 2025

Content version: 1.0.0

Canonical Identity

Term code
HE-ES-SA-189

Stable URI · Machine-readable · Resolvable · CC BY 4.0