Skip to content

Lesson M06.L03: Heteroskedasticity-Robust Standard Errors

Field Detail
Module 06 — Heteroskedasticity
Level Graduate
Duration 30–35 min
Learning Objective Understand the sandwich estimator for heteroskedasticity-robust standard errors; apply robust SEs in Stata and R; correctly interpret the effect on inference; understand why robust SEs do not fix coefficient estimates.
Provenance Wooldridge Introductory Econometrics, Ch 8.2

Explanation

Motivation: Fixing Inference Without Changing Estimates

We established in M06.L01 that heteroskedasticity leaves OLS estimates unbiased and consistent but corrupts the standard errors — and therefore all t-tests, F-tests, and confidence intervals. The robust standard error approach provides a way to obtain valid inference under heteroskedasticity without changing the coefficient estimates and without needing to know the exact form of heteroskedasticity.


The OLS Variance Estimator (Homoskedastic Case)

Under homoskedasticity, the variance-covariance matrix of \(\hat{\boldsymbol{\beta}}\) is:

\[\text{Var}(\hat{\boldsymbol{\beta}} \mid \mathbf{X}) = \sigma^2 (\mathbf{X}'\mathbf{X})^{-1}\]

Estimated by replacing \(\sigma^2\) with \(\hat{\sigma}^2 = SSR/(n-k-1)\):

\[\widehat{\text{Var}}_{OLS}(\hat{\boldsymbol{\beta}}) = \hat{\sigma}^2 (\mathbf{X}'\mathbf{X})^{-1}\]

This formula is only valid if \(\text{Var}(\mathbf{u} \mid \mathbf{X}) = \sigma^2 \mathbf{I}\).


The Heteroskedasticity-Robust (Sandwich) Estimator

Under heteroskedasticity, the true variance of \(\hat{\boldsymbol{\beta}}\) is:

\[\text{Var}(\hat{\boldsymbol{\beta}} \mid \mathbf{X}) = (\mathbf{X}'\mathbf{X})^{-1} \left( \sum_{i=1}^n \sigma_i^2 \mathbf{x}_i \mathbf{x}_i' \right) (\mathbf{X}'\mathbf{X})^{-1}\]

where \(\mathbf{x}_i\) is the \(i\)th row of \(\mathbf{X}\) (as a column vector). Since \(\sigma_i^2\) is unknown, White (1980) proposed replacing \(\sigma_i^2\) with \(\hat{u}_i^2\):

\[\widehat{\text{Var}}_{HC}(\hat{\boldsymbol{\beta}}) = (\mathbf{X}'\mathbf{X})^{-1} \left( \sum_{i=1}^n \hat{u}_i^2 \mathbf{x}_i \mathbf{x}_i' \right) (\mathbf{X}'\mathbf{X})^{-1}\]

This is the Huber-Eicker-White (HEW) sandwich estimator. The name comes from its structure: the outer two factors \((\mathbf{X}'\mathbf{X})^{-1}\) are the "bread," and the middle sum \(\sum \hat{u}_i^2 \mathbf{x}_i \mathbf{x}_i'\) is the "meat."

Key property: This estimator is consistent for \(\text{Var}(\hat{\boldsymbol{\beta}})\) regardless of whether the errors are homoskedastic or heteroskedastic. It requires no assumptions about the form of \(\sigma_i^2\).


Heteroskedasticity Corrections (HC0–HC3)

Several finite-sample corrections to the basic HC estimator exist:

Estimator Formula for meat Notes
HC0 \(\hat{u}_i^2\) White's original; can be biased in small samples
HC1 \(\frac{n}{n-k-1}\hat{u}_i^2\) Degrees-of-freedom correction; Stata's default
HC2 \(\frac{\hat{u}_i^2}{1 - h_{ii}}\) Adjusts for leverage; \(h_{ii}\) = hat matrix diagonal
HC3 \(\frac{\hat{u}_i^2}{(1 - h_{ii})^2}\) More conservative; preferred in small samples

In large samples, all four give essentially the same answer. Stata's vce(robust) uses HC1. R's sandwich package offers all four.


Effect on t-statistics and Confidence Intervals

Robust SEs are typically (though not always) larger than the corresponding OLS SEs when heteroskedasticity is present:

  • Larger robust SE → smaller t-statistic → wider confidence interval → more conservative inference
  • Smaller robust SE (less common, when OLS SEs are upward biased) → larger t-statistic → narrower CI

This means some variables that appeared significant under OLS standard errors may not be significant with robust SEs — a real cost of ignoring heteroskedasticity in the original OLS analysis.


Practical Guidance: When to Use Robust SEs

Rule of thumb: Use heteroskedasticity-robust standard errors by default in all cross-sectional applied work.

Rationale:

  • If heteroskedasticity is present: robust SEs give valid inference; OLS SEs do not.
  • If errors are actually homoskedastic: robust SEs are still valid (consistent), just slightly less efficient than OLS SEs.
  • The cost of using robust SEs when unnecessary is negligible (very slight loss of efficiency in large samples).
  • The cost of not using robust SEs when heteroskedasticity is present is incorrect inference.

Asymmetric risk → always use robust SEs in cross-sectional work.

Caveat: Robust SEs rely on asymptotic (large-sample) theory. In very small samples (\(n < 50\)), they can be unreliable. HC3 is more conservative and preferred in small samples.


Worked Example

Dataset: Wooldridge WAGE1, \(n = 526\).

Model: \(\log(wage_i) = \beta_0 + \beta_1 educ_i + \beta_2 exper_i + u_i\)

Comparison of OLS vs Robust Standard Errors:

Variable \(\hat{\beta}\) OLS SE Robust SE OLS \(t\) Robust \(t\)
Intercept 0.584 0.101 0.108 5.78 5.41
educ 0.083 0.008 0.009 10.38 9.22
exper 0.025 0.005 0.006 5.00 4.17

Observations:

  1. Coefficient estimates are identical — robust SEs change only the SEs, not \(\hat{\beta}\).
  2. Robust SEs are slightly larger than OLS SEs, consistent with the presence of mild heteroskedasticity.
  3. Both \(educ\) and \(exper\) remain strongly significant under robust SEs (\(t > 4\)). The qualitative conclusions do not change here, but the magnitude of \(t\)-statistics is reduced.
  4. Confidence intervals widen slightly. For example, the 95% CI for \(\beta_{educ}\):
  5. OLS: \(0.083 \pm 1.96 \times 0.008 = [0.067, 0.099]\)
  6. Robust: \(0.083 \pm 1.96 \times 0.009 = [0.065, 0.101]\)

Stata code:

regress lwage educ exper, vce(robust)

R code:

library(sandwich); library(lmtest)
m <- lm(log(wage) ~ educ + exper, data = wage1)
coeftest(m, vcov = vcovHC(m, type = "HC1"))


Common Misconception

"Heteroskedasticity-robust standard errors fix the biased coefficient estimates caused by heteroskedasticity."

Correction: Robust standard errors only fix the standard errors (and therefore \(t\)-statistics, \(F\)-statistics, and confidence intervals). They do not change the point estimates \(\hat{\boldsymbol{\beta}}\). As established in M06.L01, OLS estimates are unbiased and consistent under heteroskedasticity — so there is nothing to fix in the coefficients. The sandwich estimator addresses only the inference problem, not an estimation problem. If a student reports "I corrected for heteroskedasticity by using robust standard errors, which fixed my biased estimates," that statement is incorrect on two counts: (a) the estimates were not biased, and (b) robust SEs don't change estimates.


Practice Prompts

Prompt 1 — OLS vs robust SEs A researcher estimates a model of house prices with \(n = 800\) observations. OLS gives:

Variable \(\hat{\beta}\) OLS SE Robust SE
Intercept 85,000 12,000 18,500
sqft 120 15 22
bedrooms 8,000 3,500 2,800

(a) For which variable does heteroskedasticity most increase the SE? What does this imply about OLS inference for that variable? (b) For the bedrooms coefficient, the OLS SE is larger than the robust SE. What does this imply about OLS inference for bedrooms? (c) Does the difference between OLS and robust SEs change the researcher's estimate of the effect of square footage on price?


Prompt 2 — Correct statement A student writes in their research paper: "We detected heteroskedasticity using the Breusch-Pagan test (\(p = 0.003\)). We therefore corrected for heteroskedasticity by re-estimating the model with robust standard errors. Our corrected coefficient estimates are now unbiased."

Identify and correct any errors in this statement.


Prompt 3 — Small sample concern A researcher has \(n = 35\) observations and detects possible heteroskedasticity. She plans to use HC1 robust standard errors.

(a) Why might HC1 be unreliable in this small sample? (b) What alternative correction would you recommend? (c) Is there any other approach she should consider?


Further Resources

  • Wooldridge, Introductory Econometrics (7th ed.), §8.2
  • White (1980), "A Heteroskedasticity-Consistent Covariance Matrix Estimator", Econometrica, 48(4), 817–838
  • MacKinnon & White (1985) — HC2 and HC3 small-sample corrections
  • Stata: regress y x1 x2, vce(robust) or regress y x1 x2, robust
  • R: coeftest(m, vcov = vcovHC(m, type = "HC1")) — sandwich + lmtest packages
  • Angrist & Pischke, Mostly Harmless Econometrics, Ch 8 — practical motivation for always using robust SEs