# Heteroscedasticity-consistent standard errors

The topic of heteroskedasticity-consistent (HC) standard errors arises in statistics and econometrics in the context of linear regression and time series analysis. These are also known as heteroskedasticity-robust standard errors (or simply robust standard errors), Eicker–Huber–White standard errors (also Huber–White standard errors or White standard errors), to recognize the contributions of Friedhelm Eicker, Peter J. Huber, and Halbert White.

In regression and time-series modelling, basic forms of models make use of the assumption that the errors or disturbances ui have the same variance across all observation points. When this is not the case, the errors are said to be heteroskedastic, or to have heteroskedasticity, and this behaviour will be reflected in the residuals ${\widehat {u}}_{i}$ estimated from a fitted model. Heteroskedasticity-consistent standard errors are used to allow the fitting of a model that does contain heteroskedastic residuals. The first such approach was proposed by Huber (1967), and further improved procedures have been produced since for cross-sectional data, time-series data and GARCH estimation.

Heteroskedasticity-consistent standard errors that differ from classical standard errors may indicate model misspecification. Substituting heteroskedasticity-consistent standard errors does not resolve this misspecification, which may lead to bias in the coefficients. In most situations, the problem should be found and fixed. Other types of standard error adjustments, such as clustered standard errors, may be considered as extensions to HC standard errors.

## History

Heteroskedasticity-consistent standard errors are introduced by Friedhelm Eicker, and popularized in econometrics by Halbert White.

## Problem

Consider the linear regression model

$Y=X\beta +U,\,$ where X is the vector of explanatory variables and β is a k × 1 column vector of parameters to be estimated.

The ordinary least squares (OLS) estimator is

${\widehat {\beta }}_{\text{OLS}}=(\mathbb {X} '\mathbb {X} )^{-1}\mathbb {X} '\mathbb {Y} .\,$ where $\mathbb {X}$ denotes the matrix of stacked $X_{i}'$ values observed in the data.

If the sample errors have equal variance σ2 and are uncorrelated, then the least-squares estimate of β is BLUE (best linear unbiased estimator), and its variance is estimated with

$v_{\text{OLS}}\left[{\widehat {\beta }}_{\text{OLS}}\right]=s^{2}(\mathbb {X} '\mathbb {X} )^{-1},\quad s^{2}={\frac {\sum _{i}{\widehat {u}}_{i}^{2}}{n-k}}$ where ${\widehat {u}}_{i}=Y_{i}-X_{i}{\widehat {\beta }}_{\text{OLS}}$ are the regression residuals.

When the error terms do not have constant variance (i.e., the assumption of $\operatorname {E} [uu']=\sigma ^{2}I_{n}$ is untrue), the OLS estimator loses its desirable properties. The formula for variance now cannot be simplified:

$V\left[{\widehat {\beta }}_{\text{OLS}}\right]=V[(\mathbb {X} '\mathbb {X} )^{-1}\mathbb {X} '\mathbb {Y} ]=(\mathbb {X} '\mathbb {X} )^{-1}\mathbb {X} '\Sigma \mathbb {X} (\mathbb {X} '\mathbb {X} )^{-1}$ where $\Sigma =V[u].$ While the OLS point estimator remains unbiased, it is not "best" in the sense of having minimum mean square error, and the OLS variance estimator $v_{\text{OLS}}\left[{\widehat {\beta }}_{\text{OLS}}\right]$ does not provide a consistent estimate of the variance of the OLS estimates.

For any non-linear model (for instance logit and probit models), however, heteroskedasticity has more severe consequences: the maximum likelihood estimates of the parameters will be biased (in an unknown direction), as well as inconsistent (unless the likelihood function is modified to correctly take into account the precise form of heteroskedasticity). As pointed out by Greene, “simply computing a robust covariance matrix for an otherwise inconsistent estimator does not give it redemption.”

## Solution

If the regression errors $u_{i}$ are independent, but have distinct variances σi2, then $\Sigma =\operatorname {diag} (\sigma _{1}^{2},\ldots ,\sigma _{n}^{2})$ which can be estimated with ${\widehat {\sigma }}_{i}^{2}={\widehat {u}}_{i}^{2}$ . This provides White's (1980) estimator, often referred to as HCE (heteroskedasticity-consistent estimator):

{\begin{aligned}v_{\text{HCE}}\left[{\widehat {\beta }}_{\text{OLS}}\right]&={\frac {1}{n}}\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'\right)^{-1}\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'{\widehat {u}}_{i}^{2}\right)\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'\right)^{-1}\\&=(\mathbb {X} '\mathbb {X} )^{-1}(\mathbb {X} '\operatorname {diag} ({\widehat {u}}_{1}^{2},\ldots ,{\widehat {u}}_{n}^{2})\mathbb {X} )(\mathbb {X} '\mathbb {X} )^{-1},\end{aligned}} where as above $\mathbb {X}$ denotes the matrix of stacked $X_{i}'$ values from the data. The estimator can be derived in terms of the generalized method of moments (GMM).

Also often discussed in the literature (including White's paper) is the covariance matrix ${\widehat {\Omega }}_{n}$ of the ${\sqrt {n}}$ -consistent limiting distribution:

${\sqrt {n}}({\widehat {\beta }}_{n}-\beta )\,{\xrightarrow {d}}\,N(0,\Omega ),$ where

$\Omega =\operatorname {E} [XX']^{-1}\operatorname {Var} [Xu]\operatorname {E} [XX']^{-1},$ and

{\begin{aligned}{\widehat {\Omega }}_{n}&=\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'\right)^{-1}\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'{\widehat {u}}_{i}^{2}\right)\left({\frac {1}{n}}\sum _{i}X_{i}X_{i}'\right)^{-1}\\&=n(\mathbb {X} '\mathbb {X} )^{-1}(\mathbb {X} '\operatorname {diag} ({\widehat {u}}_{1}^{2},\ldots ,{\widehat {u}}_{n}^{2})\mathbb {X} )(\mathbb {X} '\mathbb {X} )^{-1}\end{aligned}} Thus,

${\widehat {\Omega }}_{n}=n\cdot v_{\text{HCE}}[{\widehat {\beta }}_{\text{OLS}}]$ and

${\widehat {\operatorname {Var} }}[Xu]={\frac {1}{n}}\sum _{i}X_{i}X_{i}'{\widehat {u}}_{i}^{2}={\frac {1}{n}}\mathbb {X} '\operatorname {diag} ({\widehat {u}}_{1}^{2},\ldots ,{\widehat {u}}_{n}^{2})\mathbb {X} .$ Precisely which covariance matrix is of concern is a matter of context.

Alternative estimators have been proposed in MacKinnon & White (1985) that correct for unequal variances of regression residuals due to different leverage. Unlike the asymptotic White's estimator, their estimators are unbiased when the data are homoscedastic.

• Julia: the CovarianceMatrices package offers several methods for heteroskedastic robust variance covariance matrices.
• MATLAB: See the hac function in the Econometrics toolbox.
• R: the vcovHC() command from the sandwich package.
• Stata: robust option applicable in many pseudo-likelihood based procedures.
• Gretl: the option --robust to several estimation commands (such as ols) in the context of a cross-sectional dataset produces robust standard errors.