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. It was devised by Whitney K. Newey and Kenneth D. West in 1987, although there are a number of later variants. The estimator is used to try to overcomeautocorrelation, and heteroskedasticity in the error terms in the models, often for regressions applied to time seriesdata. The problem in autocorrelation, often found in time series data, is that the error terms are correlated over time. This can be demonstrated in, a matrix of sums of squares and cross products that involves and the rows of. The least squares estimator is a consistent estimator of. This implies that the least squares residuals are "point-wise" consistent estimators of their population counterparts. The general approach, then, will be to use and to devise an estimator of. 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 regression when the residuals are heteroskedastic and/or autocorrelated. 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 to a finite matrix.
Software implementations
In Julia, the CovarianceMatrices.jl package supports several types of heteroskedasticity and autocorrelation consistent covariance matrix estimation including Newey–West, White, and Arellano. In R, the packages sandwich and plm include a function for the Newey–West estimator. In Stata, the commandnewey produces Newey–West standard errors for coefficients estimated by OLS regression. In MATLAB, the command hac in the Econometrics toolbox produces the Newey–West estimator. In Python, the statsmodels module includes functions for the covariance matrix using Newey-West. In Gretl, the option --robust to several estimation commands in the context of a time-series dataset produces Newey–West standard errors. In SAS, the Newey-West corrected standard errors can be obtained in PROC AUTOREG and PROC MODEL