Tutorials › Econometrics (Graduate) › Worked Comparison of HC and Bootstrap Inference

Heteroskedasticity-Robust Inference · Tutorial 122 of 952

Worked Comparison of HC and Bootstrap Inference

Work through one heteroskedastic regression to compare HC standard errors, robust joint inference, and a wild-bootstrap-t test.

Intermediate 10 min read

What You'll Learn

  • State the regression assumptions needed for heteroskedasticity-robust inference.
  • Compare how HC0 through HC5 adjust the estimated covariance matrix.
  • Read residual plots as diagnostics without using them to choose inference after the fact.
  • Calculate and interpret a robust joint Wald test.
  • Compute a wild-bootstrap-t p-value and compare it with asymptotic inference.

Why Compare Robust Inference Methods?

In cross-sectional regression, the conditional variance of the error may change with the regressors. A fan-shaped residual plot can make this possibility visible, but it does not by itself tell us which standard error or test to use. A useful analysis instead reports how conclusions behave under reasonable variance estimators and, when appropriate, a bootstrap procedure. This comparison is especially informative in a modest sample, where high-leverage observations can affect estimated standard errors.

The HC covariance estimators all leave the ordinary least-squares coefficient estimates unchanged. They differ in how they use the residuals and the leverage of each observation to estimate coefficient uncertainty. Wild-bootstrap-t inference takes another route: it approximates the null distribution of a studentized statistic by repeatedly generating outcomes under the null while allowing the error scale to differ across observations.

Model and assumptions: Consider \(y_i=x_i'\beta+u_i\), for \(i=1,\ldots,n\), where \(x_i\) includes an intercept and the regressors, and the design matrix has full column rank \(k\). For the cross-sectional analysis here, assume observations are independent, \(E(u_i\mid X)=0\), and the errors have finite moments sufficient for the robust covariance and bootstrap approximations. The conditional variance \(E(u_i^2\mid X)\) may differ across observations. These conditions do not permit endogeneity or a misspecified conditional mean; heteroskedasticity-robust methods do not repair either problem.

Write the least-squares residual as \(\hat u_i=y_i-x_i'\hat\beta\), and let \(h_i\) be the \(i\)th diagonal element of the OLS hat matrix. The HC covariance estimators have the sandwich form \((X'X)^{-1}X'\Omega X(X'X)^{-1}\), where \(\Omega\) is diagonal and its \(i\)th entry specifies how the squared residual is adjusted. Their estimated standard errors are the square roots of the diagonal entries of the resulting covariance matrix.

What HC0 Through HC5 Change

HC0 uses the squared residual without a degrees-of-freedom or leverage adjustment. HC1 multiplies HC0 by \(n/(n-k)\). HC2 divides each squared residual by \(1-h_i\), and HC3 divides it by \((1-h_i)^2\). HC4 and HC5 use leverage-dependent powers so that observations with unusually high leverage can receive stronger adjustments. In the definitions below, \(\bar h=k/n\), \(h_{\max}=\max_i h_i\), and the HC5 constant is \(0.7\).

$$ \begin{aligned} \widehat V_{\mathrm{HC0}} &=(X'X)^{-1}\left(\sum_{i=1}^n x_i x_i'\hat u_i^2\right)(X'X)^{-1},\\ \widehat V_{\mathrm{HC1}} &=\frac{n}{n-k}\widehat V_{\mathrm{HC0}},\\ \widehat V_{\mathrm{HC2}} &=(X'X)^{-1}\left(\sum_{i=1}^n x_i x_i'\frac{\hat u_i^2}{1-h_i}\right)(X'X)^{-1},\\ \widehat V_{\mathrm{HC3}} &=(X'X)^{-1}\left(\sum_{i=1}^n x_i x_i'\frac{\hat u_i^2}{(1-h_i)^2}\right)(X'X)^{-1},\\ \widehat V_{\mathrm{HC4}} &: \quad \frac{\hat u_i^2}{(1-h_i)^{\delta_i}},\qquad \delta_i=\min\left(4,\frac{h_i}{\bar h}\right),\\ \widehat V_{\mathrm{HC5}} &: \quad \frac{\hat u_i^2}{(1-h_i)^{\delta_i/2}},\qquad \delta_i=\min\left(\frac{h_i}{\bar h},\max\left(4,\frac{0.7h_{\max}}{\bar h}\right)\right). \end{aligned} $$

HC1 is a finite-sample scaling of HC0; HC2 and HC3 apply progressively stronger individual leverage corrections. HC4 and HC5 are designed to give additional attention to extreme leverage, but their adjustments are not guaranteed to produce larger standard errors for every coefficient in every data set. None of the estimators changes \(\hat\beta\), and none makes inference reliable when its underlying assumptions fail. The familiar large-sample reference distributions for robust statistics are approximations, not exact finite-sample guarantees.

Worked Example: Reading a Residual Diagnostic

Suppose a hypothetical cross-sectional data set contains 48 firms. The outcome \(y_i\) is annual revenue growth, measured in percentage points, and the regressors are an intercept, firm size \(x_{1i}\), and an export indicator \(x_{2i}\). A plot of OLS residuals against fitted values shows a relatively narrow vertical spread at low fitted values and a wider spread at high fitted values. The largest leverage is \(0.31\), while the average leverage is \(k/n=3/48=0.0625\).

The widening spread is a warning that the conditional variance may not be constant. It is not a proof: residual patterns can also reflect an omitted nonlinear component or an unusual observation. The leverage value is \(0.31/0.0625=4.96\) times the average, so the observation deserves inspection because leverage corrections may matter. A residual plot cannot establish that the conditional mean is correctly specified or that observations are independent.

The appropriate response is to examine the regression specification and data quality, and to report inference that does not require constant conditional variance. In this example, the analysis will compare HC estimators and a wild bootstrap rather than select a method only after a variance test or plot. The residual pattern motivates the comparison; it does not determine the result.

Comparing Standard Errors in One Regression

For a concrete comparison, suppose the hypothetical OLS estimates are \(\hat\beta_1=0.42\) percentage points per unit of firm size and \(\hat\beta_2=-0.18\) percentage points for the export indicator relative to non-exporters. The sample size is \(n=48\), with \(k=3\) estimated coefficients including the intercept. The table gives hypothetical standard errors computed from the same fitted regression. The HC3 entries correspond to variances \(0.0350\) and \(0.0196\) for the two slope estimates.

Covariance estimatorSE for firm sizeSE for export indicator
HC00.1510.116
HC10.1560.120
HC20.1690.129
HC30.18710.1400
HC40.2110.158
HC50.2240.165

For firm size, the HC3 statistic for \(H_0:\beta_1=0\) is \(0.42/0.1871\approx2.245\). Using a standard normal reference, this is a two-sided p-value of about \(0.0247\). The HC0 standard error would give a larger statistic, \(0.42/0.151\approx2.78\), and therefore a smaller p-value. The difference illustrates why a method that makes no leverage correction can suggest more precision in a setting where leverage is consequential. The figures are an illustration, not a general ranking: in another data set, the HC estimates can be closer together or ordered differently.

Interpretation: An HC standard error estimates uncertainty in a coefficient under the specified conditional-mean model while allowing nonconstant error variance. It is not a correction for omitted variables, dependence between observations, or an inappropriate functional form. A p-value is calculated relative to a specified null and reference distribution; it is not the probability that the null hypothesis is true.

A Robust Joint Wald Test

Separate coefficient tests do not answer whether several restrictions hold jointly. For a \(q\)-dimensional restriction \(R\beta=r\), the robust Wald statistic is formed from the estimated coefficient vector and its robust covariance matrix. Under the null and standard large-sample regularity conditions, it is approximately chi-squared with \(q\) degrees of freedom. This approximation uses the robust covariance estimator chosen for the analysis.

$$ W=(R\hat\beta-r)'\left[R\widehat V R'\right]^{-1}(R\hat\beta-r) \ \overset{approx}{\sim}\ \chi^2_q. $$

Worked Example: Testing Two Slopes Jointly

Use the HC3 covariance matrix for the two slope estimates, \[ \widehat V= \begin{pmatrix} 0.0350 & 0.0060\\ 0.0060 & 0.0196 \end{pmatrix}, \] and test \(H_0:\beta_1=\beta_2=0\) against the alternative that at least one slope is nonzero. The estimated slope vector is \((0.42,-0.18)'\), and there are two restrictions, so \(q=2\).

The determinant of the covariance matrix is \[ (0.0350)(0.0196)-(0.0060)^2=0.000686-0.000036=0.000650. \] Its inverse is therefore \[ \widehat V^{-1}=\frac{1}{0.000650} \begin{pmatrix} 0.0196 & -0.0060\\ -0.0060 & 0.0350 \end{pmatrix}. \] The resulting quadratic form is

$$ \begin{aligned} W &=\frac{0.0196(0.42)^2-2(0.0060)(0.42)(-0.18)+0.0350(-0.18)^2}{0.000650}\\ &=\frac{0.00345744+0.0009072+0.001134}{0.000650}\\ &=\frac{0.00549864}{0.000650} =8.459446\ldots\approx8.46. \end{aligned} $$

For a chi-squared distribution with two degrees of freedom, the upper-tail probability is \(\exp(-W/2)\). Thus the approximate p-value is \(\exp(-8.459446/2)\approx0.0146\). At the 5% significance level, this provides evidence against the joint null that both slopes are zero. It does not establish that either coefficient has a causal interpretation; that would require additional design and identification assumptions.

Wild-Bootstrap-t Comparison

A wild bootstrap is useful when the errors may be heteroskedastic because it changes the sign or scale of each residual separately rather than resampling whole observations as pairs. In a test of a coefficient, the bootstrap is constructed under the null restriction. A studentized statistic is calculated in each replication, using a robust standard error in both the observed and bootstrap samples. The resulting bootstrap distribution can provide a finite-sample alternative to a normal or chi-squared approximation, though it is not automatically exact.

Worked Example: A Wild-Bootstrap-t Test

Continue with the firm-size coefficient and use the HC3 standard error \(0.1871\). The observed statistic for testing \(H_0:\beta_1=0\) is \[ t_{\mathrm{obs}}=\frac{0.42}{0.1871}=2.245\text{ (approximately)}. \] Fit the regression subject to \(\beta_1=0\). For each of \(B=9{,}999\) replications, form a bootstrap outcome from the restricted fitted value plus a leverage-adjusted restricted residual multiplied by an independent Rademacher draw, which equals \(+1\) or \(-1\) with probability \(1/2\). Refit the unrestricted regression and calculate its HC3-studentized statistic \(t_b^*\).

Suppose 286 of the 9,999 bootstrap statistics have absolute value at least \(2.245\). With the usual plus-one correction, the two-sided bootstrap p-value is \[ \hat p_{\mathrm{boot}}=\frac{1+\sum_{b=1}^{B}I(|t_b^*|\geq|t_{\mathrm{obs}}|)}{B+1} =\frac{1+286}{9{,}999+1} =\frac{287}{10{,}000}=0.0287. \]

The bootstrap p-value is somewhat larger than the large-sample normal-reference value of approximately \(0.0247\), but both are below \(0.05\) in this hypothetical calculation. The bootstrap result is conditional on the chosen null-restricted fitting and residual adjustment scheme, and it has Monte Carlo error because only finitely many replications were run. It is a comparison, not a guarantee that the bootstrap must be more accurate in every sample.

How to Report the Comparison

A transparent report names the coefficient scale and units, the covariance estimator used for each test, the reference distribution, and the test statistic or p-value. For multiple restrictions, it states the restriction vector and degrees of freedom. If bootstrap inference is reported, it identifies the null construction, the studentization method, the number of replications, and the p-value calculation. Reporting only the method that gives the smallest p-value obscures how sensitive the conclusion is to reasonable inferential choices.

The comparison also helps separate two questions. First, does the conditional-mean model adequately describe the relationship being estimated? Second, given that model, how should uncertainty be estimated when variance is nonconstant? HC and wild-bootstrap procedures address the second question. Residual plots and subject-matter reasoning inform the first, but neither a robust standard error nor a bootstrap can compensate for a seriously misspecified mean.

Common Mistakes

  • Treating HC0–HC5 as different coefficient estimators. They change the estimated covariance matrix and standard errors, not the OLS coefficient estimates.
  • Assuming HC5 must always be the most conservative. Leverage adjustments can affect coefficients differently, and the standard errors need not have a universal ordering.
  • Using a residual plot as a definitive heteroskedasticity test. A pattern is diagnostic evidence, not proof of a particular error process or of a correct conditional mean.
  • Choosing a standard error only after a preliminary variance test. Such pretesting can make reported inference depend on a noisy selection step. State a defensible approach and compare reasonable alternatives where useful.
  • Interpreting a robust p-value as a probability that the null is true. It is the probability, under the null and the stated reference approximation, of a statistic at least as extreme as the one observed.
Key takeaway: In a cross-sectional regression with possible heteroskedasticity, HC0–HC5 and wild-bootstrap-t inference offer related but distinct ways to quantify uncertainty. Diagnose the regression, state the assumptions, compare methods when finite-sample leverage matters, and interpret each test in its model and units.

Check Your Understanding

Use the definitions and calculations in this tutorial to answer the following.

  1. What feature of HC2 and HC3 distinguishes them from HC0, and how does HC3 differ from HC2?
  2. In the hypothetical regression, what does a widening residual spread suggest, and what does it not establish?
  3. Why is the joint Wald statistic based on the full covariance matrix rather than on two separate standard errors alone?
  4. How is the wild-bootstrap-t p-value \(0.0287\) obtained from 286 exceedances and 9,999 replications?
  5. Name two problems that HC standard errors do not solve, even if they address nonconstant conditional variance.
Clinical Biostats