# Newey–West estimator

A Newey–West estimator is used in statistics and econometrics to provide an estimate of the covariance matrix of the parameters of a regression-type model when this model is applied in situations where the standard assumptions of regression analysis do not apply.[1] It was devised by Whitney K. Newey and Kenneth D. West in 1987, although there are a number of later variants.[2][3][4][5] The estimator is used to try to overcome autocorrelation (also called serial correlation), and heteroskedasticity in the error terms in the models, often for regressions applied to time series data.

The problem in autocorrelation, often found in time series data, is that the error terms are correlated over time. This can be demonstrated in ${\displaystyle Q^{*}}$, a matrix of sums of squares and cross products that involves ${\displaystyle \sigma _{(ij)}}$ and the rows of ${\displaystyle X}$. The least squares estimator ${\displaystyle b}$ is a consistent estimator of ${\displaystyle \beta }$. This implies that the least squares residuals ${\displaystyle e_{i}}$ are "point-wise" consistent estimators of their population counterparts ${\displaystyle E_{i}}$. The general approach, then, will be to use ${\displaystyle X}$ and ${\displaystyle e}$ to devise an estimator of ${\displaystyle Q^{*}}$.[6] This means that as the time between error terms increases, the correlation between the error terms decreases. The estimator thus can be used to improve the ordinary least squares (OLS) regression when the residuals are heteroskedastic and/or autocorrelated.

${\displaystyle Q^{*}={\frac {1}{T}}\sum _{t=1}^{T}e_{t}^{2}x_{t}x'_{t}+{\frac {1}{T}}\sum _{\ell =1}^{L}\sum _{t=\ell +1}^{T}w_{\ell }e_{t}e_{t-\ell }(x_{t}x'_{t-\ell }+x_{t-\ell }x'_{t})}$
${\displaystyle w_{\ell }=1-{\frac {\ell }{L+1}}}$

${\displaystyle w_{\ell }}$ can be thought of as a weight'. Disturbances that are farther apart from each other are given lower weight, while those with equal subscripts are given a weight of 1. This ensures that second term converges (in some appropriate sense) to a finite matrix.

## Software implementations

In R, the packages sandwich[7] and plm[8] include a function for the Newey–West estimator.

In Stata, the command newey produces Newey–West standard errors for coefficients estimated by OLS regression.[9]

In MATLAB, the command hac in the Econometrics toolbox produces the Newey–West estimator (among others). [10]

In Python, the statsmodels`[11] module includes functions for the covariance matrix using Newey-West.

## References

1. ^ "Newey West estimator – Quantitative Finance Collector".
2. ^ Newey, Whitney K; West, Kenneth D (1987). "A Simple, Positive Semi-definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix". Econometrica. 55 (3): 703–708. doi:10.2307/1913610. JSTOR 1913610.
3. ^ Andrews, Donald W. K. (1991). "Heteroskedasticity and autocorrelation consistent covariance matrix estimation". Econometrica. 59 (3): 817–858. doi:10.2307/2938229. JSTOR 2938229.
4. ^ Newey, Whitney K.; West, Kenneth D. (1994). "Automatic lag selection in covariance matrix estimation". Review of Economic Studies. 61 (4): 631–654. doi:10.2307/2297912. JSTOR 2297912.
5. ^ Smith, Richard J. (2005). "Automatic positive semidefinite HAC covariance matrix and GMM estimation". Econometric Theory. 21 (1): 158–170. doi:10.1017/S0266466605050103.
6. ^ Greene, William H. (1997). Econometric Analysis (3rd ed.).
7. ^
8. ^
9. ^ "Regression with Newey–West standard errors" (PDF). Stata Manual.
10. ^ "Heteroscedasticity and autocorrelation consistent covariance estimators". Econometrics Toolbox.
11. ^ "statsmodels: Statistics". statsmodels.