Tutorials › Econometrics (Graduate) › The Newey–West Bartlett Estimator

Clustered and Dependent Errors · Tutorial 137 of 952

The Newey–West Bartlett Estimator

Learn to build the Bartlett-weighted HAC sandwich, understand why it is positive semidefinite in finite samples, and compute it for a short regression.

Advanced 12 min read

What You'll Learn

  • Define the ordered regression score and the Bartlett-weighted lagged score products.
  • Construct the Newey–West sandwich covariance estimator for a specified maximum lag.
  • Prove positive semidefiniteness using sums of outer products of windowed scores.
  • Calculate a scalar HAC estimate and a two-coefficient regression covariance matrix.
  • Distinguish a positive semidefinite estimate from a guarantee of valid inference.

Why the Bartlett Estimator Matters

With dependent errors, the score contributions from nearby observations can covary. An ordinary heteroskedasticity-robust covariance estimator accounts for variation in each observation’s score but omits these cross-observation terms. A heteroskedasticity-and-autocorrelation-consistent (HAC) estimator adds lagged score products, while giving less weight to more distant lags and setting sufficiently distant lags to zero.

The Newey–West estimator uses Bartlett weights: the weight declines linearly with lag until it reaches zero. This weighting rule has an important finite-sample property: the estimated covariance matrix is positive semidefinite, so no linear combination of estimated coefficients has a negative estimated variance. That property follows from the weights themselves, not from a large-sample approximation.

Definition and Construction

Consider an ordered sample of \(n\) observations from the linear regression \(y_t=x_t'\beta+u_t\), where \(y_t\) is a scalar outcome, \(x_t\) is a \(k\)-vector of regressors, and \(\beta\) is a \(k\)-vector of coefficients. Let \(\hat\beta=(X'X)^{-1}X'y\) be the OLS estimate, and let \(\hat u_t=y_t-x_t'\hat\beta\) be its residual. Assume \(X'X\) is nonsingular. The estimated score contribution at observation \(t\) is \(g_t=x_t\hat u_t\), a \(k\)-vector.

Definition: For a specified nonnegative integer \(L\), the Bartlett weight at lag \(\ell\) is \(w_\ell=1-\ell/(L+1)\) for \(0\leq\ell\leq L\). The Newey–West “meat” matrix is $$ \widehat S_L=\sum_{t=1}^n g_tg_t' +\sum_{\ell=1}^{L}w_\ell\sum_{t=\ell+1}^{n} \left(g_tg_{t-\ell}'+g_{t-\ell}g_t'\right), $$ where a lag with \(\ell\geq n\) contributes no terms. The corresponding OLS covariance estimator is $$ \widehat{\operatorname{Var}}(\hat\beta)_{\mathrm{NW}} =(X'X)^{-1}\widehat S_L(X'X)^{-1}. $$

The two products at each positive lag are transposes of one another, so the meat matrix is symmetric. The lag-zero term uses each score’s outer product once; each positive-lag cross-product pair is weighted by \(w_\ell\). In particular, \(w_0=1\), \(w_L=1/(L+1)\), and the Bartlett sequence would assign weight zero at lag \(L+1\). The displayed formula is the unscaled finite-sample sandwich form; it does not automatically include a degrees-of-freedom multiplier.

The construction can also be expressed through lagged score cross-products \(\widehat\Gamma_\ell=\sum_{t=\ell+1}^n g_tg_{t-\ell}'\). Then \(\widehat S_L=\widehat\Gamma_0+\sum_{\ell=1}^Lw_\ell(\widehat\Gamma_\ell+\widehat\Gamma_\ell')\), with \(\widehat\Gamma_0=\sum_{t=1}^n g_tg_t'\). This form emphasizes that the estimated long-run score variation combines contemporaneous and lagged dependence.

Worked Example: A Scalar Bartlett Calculation

Suppose a hypothetical intercept-only regression has residual score sequence \(g_1=1,\ g_2=-2,\ g_3=1\), in arbitrary outcome units. The scores sum to zero, as OLS residuals do in an intercept-only regression. Calculate the meat for \(L=1\).

The lag-zero contribution is \(1^2+(-2)^2+1^2=6\). The lag-one score products sum to \(g_2g_1+g_3g_2=(-2)(1)+(1)(-2)=-4\). With \(L=1\), the weight is \(w_1=1-1/2=0.5\), and the lag contribution includes both directions:

$$ \widehat S_1=6+0.5\{(-4)+(-4)\}=6-4=2. $$

Thus the estimated long-run score variation is 2 in squared score units. For an intercept-only regression with three observations, \(X'X=3\), so the sandwich estimate of the intercept variance is \(2/3^2=2/9\), or approximately 0.2222 squared outcome units. This is a calculation illustrating the estimator, not a claim that a three-observation sample supports reliable inference.

Why the Finite-Sample Matrix Is Positive Semidefinite

A symmetric matrix \(A\) is positive semidefinite if \(a'Aa\geq0\) for every vector \(a\) of the appropriate dimension. To establish the property for the Bartlett meat, define \(w_h=1-|h|/(L+1)\) when \(|h|\leq L\), and \(w_h=0\) otherwise. The meat can be written as \(\widehat S_L=\sum_{t=1}^n\sum_{s=1}^n w_{t-s}g_tg_s'\). This double sum is exactly the lag-zero term plus the two weighted cross-product terms for each positive lag in the definition.

For any two integer indices \(t,s\), the number of consecutive windows of length \(L+1\) that contain both indices is \(L+1-|t-s|\) when \(|t-s|\leq L\), and zero otherwise. Consequently, the Bartlett weight has the representation

$$ w_{t-s}=\frac{1}{L+1}\sum_{r\in\mathbb Z} \mathbf{1}\{r\leq t\leq r+L\}\mathbf{1}\{r\leq s\leq r+L\}. $$

Substituting this identity into the double sum and collecting terms within each window gives the finite-sample representation

$$ \widehat S_L= \frac{1}{L+1}\sum_{r\in\mathbb Z} \left(\sum_{\substack{1\leq t\leq n\\r\leq t\leq r+L}}g_t\right) \left(\sum_{\substack{1\leq s\leq n\\r\leq s\leq r+L}}g_s\right)'. $$

Only finitely many windows in this sum contain any observed score. For any vector \(a\), let \(G_r\) denote the sum of scores in window \(r,\ldots,r+L\), restricted to the observed sample. Then

$$ a'\widehat S_La =\frac{1}{L+1}\sum_r(a'G_r)^2\geq0. $$

Every term is a square multiplied by a positive constant. This proves that \(\widehat S_L\) is positive semidefinite for any finite score sequence, without requiring the errors to be independent or the sample to be large. Since \(X'X\) is nonsingular, for any coefficient vector \(c\), \(c'(X'X)^{-1}\widehat S_L(X'X)^{-1}c\geq0\) as well: apply the meat result to \(a=(X'X)^{-1}c\). Thus the sandwich covariance estimate is also positive semidefinite.

Worked Example: Checking a Quadratic Form by Windows

Take three hypothetical two-dimensional score vectors \(g_1=(1,0)'\), \(g_2=(0,1)'\), and \(g_3=(-1,1)'\), with \(L=1\). The lag-zero sum is

$$ \sum_{t=1}^3g_tg_t'= \begin{pmatrix}2&-1\\-1&2\end{pmatrix}. $$

The lag-one sum in one direction is \(\widehat\Gamma_1=g_2g_1'+g_3g_2'=\begin{pmatrix}0&-1\\1&1\end{pmatrix}\). Since \(w_1=1/2\), the meat adds \((\widehat\Gamma_1+\widehat\Gamma_1')/2=\begin{pmatrix}0&0\\0&1\end{pmatrix}\). Therefore \(\widehat S_1=\begin{pmatrix}2&-1\\-1&3\end{pmatrix}\).

For \(a=(1,-1)'\), direct calculation gives \(a'\widehat S_1a=2+2+3=7\). The window sums of length two, including the boundary windows, are \(G_0=(1,0)'\), \(G_1=(1,1)'\), \(G_2=(-1,2)'\), and \(G_3=(-1,1)'\). Their inner products with \(a\) are 1, 0, \(-3\), and \(-2\), so the window representation gives \(\{1^2+0^2+(-3)^2+(-2)^2\}/2=7\). The two calculations agree and exhibit the nonnegative quadratic form directly.

Worked Regression Calculation

The next example calculates the full sandwich for a short, hypothetical regression. It makes the ordering explicit because the lagged products depend on which observations are adjacent.

Worked Example: Newey–West Covariance for an Intercept and Slope

Consider four consecutive observations in a regression of an outcome \(y_t\), measured in points, on an intercept and an exposure \(x_t\), measured in exposure units. The hypothetical data are \(x=(-1,0,1,2)\) and \(y=(1,-2,1,0)\). Use \(L=1\).

The sample sums are \(\sum_t y_t=0\), \(\sum_t x_t=2\), \(\sum_t x_t^2=6\), and \(\sum_t x_ty_t=0\). Thus

$$ X'X=\begin{pmatrix}4&2\\2&6\end{pmatrix}, \qquad X'y=\begin{pmatrix}0\\0\end{pmatrix}, \qquad \hat\beta=\begin{pmatrix}0\\0\end{pmatrix}. $$

The residuals are consequently \(\hat u=(1,-2,1,0)\). The score vectors \(g_t=(\hat u_t,x_t\hat u_t)'\) are \(g_1=(1,-1)'\), \(g_2=(-2,0)'\), \(g_3=(1,1)'\), and \(g_4=(0,0)'\). Their lag-zero outer products sum to

$$ \widehat\Gamma_0= \begin{pmatrix}6&0\\0&2\end{pmatrix}. $$

For lag one, the three ordered products are \(g_2g_1'=\begin{pmatrix}-2&2\\0&0\end{pmatrix}\), \(g_3g_2'=\begin{pmatrix}-2&0\\-2&0\end{pmatrix}\), and \(g_4g_3'=0\). Hence \(\widehat\Gamma_1=\begin{pmatrix}-4&2\\-2&0\end{pmatrix}\). With \(w_1=1/2\), the lag-one addition is

$$ \frac12(\widehat\Gamma_1+\widehat\Gamma_1') =\begin{pmatrix}-4&0\\0&0\end{pmatrix}, \qquad \widehat S_1= \begin{pmatrix}2&0\\0&2\end{pmatrix}. $$

The bread is

$$ (X'X)^{-1} =\frac{1}{20}\begin{pmatrix}6&-2\\-2&4\end{pmatrix} =\begin{pmatrix}0.3&-0.1\\-0.1&0.2\end{pmatrix}. $$

Multiplying both sides of the meat gives

$$ \widehat{\operatorname{Var}}(\hat\beta)_{\mathrm{NW}} = \begin{pmatrix}0.3&-0.1\\-0.1&0.2\end{pmatrix} \begin{pmatrix}2&0\\0&2\end{pmatrix} \begin{pmatrix}0.3&-0.1\\-0.1&0.2\end{pmatrix} = \begin{pmatrix}0.20&-0.10\\-0.10&0.10\end{pmatrix}. $$

For example, the upper-right entry is \(0.3(2)(-0.1)+(-0.1)(2)(0.2)=-0.06-0.04=-0.10\). The estimated standard errors are \(\sqrt{0.20}=0.4472\) points for the intercept and \(\sqrt{0.10}=0.3162\) points per exposure unit for the slope. These are estimated standard errors from a four-observation illustration, not a basis for asserting that an inferential approximation is reliable.

What the Estimator Does—and Does Not—Establish

The Bartlett estimator is a way to estimate coefficient uncertainty when score contributions may be heteroskedastic and serially dependent. The coefficient estimates remain OLS; it is the covariance estimate that changes. For asymptotic HAC inference, the regression and dependence process must satisfy appropriate regularity conditions, such as a nonsingular limiting regressor second moment and sufficiently weak dependence and finite moments. Positive semidefiniteness alone does not verify those conditions, establish that the estimate is close to the true covariance, or guarantee accurate finite-sample confidence intervals and tests.

In practice, the user must specify a maximum lag \(L\) for the calculation. The Bartlett rule determines how lags up to that value are weighted; it does not choose a suitable value for a particular application. The number of observations, the dependence pattern, and the inferential goal matter when making that choice. Also, the observation order must correspond to the sequence whose dependence is being modelled: reordering observations changes the lagged products and therefore changes the estimate.

A common mistake is to calculate only \(\sum_t g_tg_{t-\ell}'\) at each positive lag, without adding its transpose. That leaves an asymmetric meat matrix and does not implement the stated HAC covariance formula. The correction is to include \(w_\ell(\widehat\Gamma_\ell+\widehat\Gamma_\ell')\) at every positive lag. Another mistake is to infer that a positive semidefinite estimate must be accurate: the proof guarantees nonnegative estimated variances, not correct uncertainty quantification under every dependence process or sample size.

Key takeaway: The Newey–West Bartlett estimator combines the OLS bread with a score meat that includes symmetrized lagged cross-products and linearly declining weights. Its finite-sample positive semidefiniteness follows from expressing that meat as a sum of outer products of windowed scores.

Check Your Understanding

Answer each question by referring to the estimator’s definition and its assumptions.

  1. For a maximum lag \(L=3\), what are the Bartlett weights at lags 1 and 3?
  2. Why does the meat include both \(g_tg_{t-\ell}'\) and \(g_{t-\ell}g_t'\) at a positive lag?
  3. State the window-sum representation that establishes positive semidefiniteness of the Bartlett meat.
  4. For a scalar score sequence \(g=(2,-1)\) and \(L=1\), calculate the lag-zero term, the lag-one contribution, and the meat.
  5. What does positive semidefiniteness guarantee, and what does it not guarantee about inference?
Clinical Biostats