10
May 18

## The Newey-West estimator: uncorrelated and correlated data

I hate long posts but here we by necessity have to go through all ideas and calculations, to understand what is going on. One page of formulas in A. Patton's guide to FN3142 Quantitative Finance in my rendition becomes three posts.

## Preliminaries and autocovariance function

Let $X_1,...,X_n$ be random variables. We need to recall that the variance of the vector $X=(X_1,...,X_n)^T$ is

(1) $V(X)=\left(\begin{array}{cccc}V(X_1)&Cov(X_1,X_2)&...&Cov(X_1,X_n)\\Cov(X_2,X_1)&V(X_2)&...&Cov(X_2,X_n)\\...&...&...&...\\Cov(X_n,X_1)&Cov(X_n,X_2)&...&V(X_n)\end{array}\right).$

With the help of this matrix we derived two expressions for variance of a linear combination:

(2) $V\left(\sum_{i=1}^na_iX_i\right)=\sum_{i=1}^na_i^2V(X_i)$

for uncorrelated variables and

(3) $V\left(\sum_{i=1}^na_iX_i\right)=\sum_{i=1}^na_i^2V(X_i)+2\sum_{i=1}^{n-1}\sum_{j=i+1}^na_ia_jCov(X_i,X_j)$

when there is autocorrelation.

In a time series context $X_1,...,X_n$ are observations along time. $1,...,n$ stand for moments in time and the sequence $X_1,...,X_n$ is called a time series. We need to recall the definition of a stationary process. Of that definition, we will use only the part about covariances: $Cov(X_i,X_j)$ depends only on the distance $|i-j|$ between the time moments $i,j.$ For example, in the top right corner of (1) we have $Cov(X_1,X_n),$ which depends only on $n-1.$

Preamble. Let $X_1,...,X_n$ be a stationary times series. Firstly, $Cov(X_i,X_i+k)$ depends only on $k.$ Secondly, for all integer $k=0,\pm 1,\pm 2,...$ denoting $j=i+k$ we have

(4) $Cov(X_i,X_{i+k})=Cov(X_{j-k},X_j)=Cov(X_j,X_{j-k}).$

Definition. The autocovariance function is defined by

(5) $\gamma_k=Cov(X_i,X_{k+i})$ for all integer $k=0,\pm 1,\pm 2,...$

In particular,

(6) $\gamma_0=Cov(X_i,X_i)=V(X_i)$ for all $i.$

The preamble shows that definition (5) is correct (the right side in (5) depends only on $k$ and not on $i$). Because of (4) we have symmetry $\gamma_{-k}=\gamma _k,$ so negative $k$ can be excluded from consideration.

With (5) and (6) for a stationary series (1) becomes

(7) $V(X)=\left(\begin{array}{cccc}\gamma_0&\gamma_1&...&\gamma_{n-1}\\ \gamma_1&\gamma_0&...&\gamma_{n-2}\\...&...&...&...\\ \gamma_{n-1}&\gamma_{n-2}&...&\gamma_0\end{array}\right).$

## Estimating variance of a sample mean

Uncorrelated observations. Suppose $X_1,...,X_n$ are uncorrelated observations from the same population with variance $\sigma^2.$ From (2)
we get

(8) $V\left(\frac{1}{n}\sum_{i=1}^nX_i\right) =\frac{1}{n^2}\sum_{i=1}^nV(X_i)=\frac{n\sigma^2}{n^2}=\frac{\sigma^2}{n}.$

This is a theoretical relationship. To actually obtain an estimator of the sample variance, we need to replace $\sigma^2$ by some estimator. It is known that

(9) $s^2=\frac{1}{n}\sum_{i=1}^n(X_i-\bar{X})^2$

consistently estimates $\sigma^2.$ Plugging it in (8) we see that variance of the sample mean is consistently estimated by

$\hat{V}=\frac{1}{n}s^2=\frac{1}{n^2}\sum_{i=1}^n(X_i-\bar{X})^2.$

This is the estimator derived on p.151 of Patton's guide.

Correlated observations. In this case we use (3):

$V\left( \frac{1}{n}\sum_{i=1}^nX_i\right) =\frac{1}{n^{2}}\left[\sum_{i=1}^nV(X_i)+2\sum_{i=1}^{n-1}\sum_{j=i+1}^nCov(X_i,X_j)\right]$.

Here visualization comes in handy. The sums in the square brackets include all terms on the main diagonal of (7) and above it. That is, we have $n$ copies of $\gamma_0,$ $n-1$ copies of $\gamma_{1}$,..., 2 copies of $\gamma _{n-2}$ and 1 copy of $\gamma _{n-1}.$ The sum in the brackets is

$\sum_{i=1}^nV(X_i)+2\sum_{i=1}^{n-1}\sum_{j=i+1}^nCov(X_i,X_j)=n\gamma_0+2[(n-1)\gamma_1+...+2\gamma_{n-2}+\gamma _{n-1}]=n\gamma _0+2\sum_{k=1}^{n-1}(n-k)\gamma_k.$

Thus we obtain the first equation on p.152 of Patton's guide (it's up to you to match the notation):

(10) $V(\bar{X})=\frac{1}{n}\gamma_0+\frac{2}{n}\sum_{k=1}^{n-1}(1-\frac{k}{n})\gamma_k.$

As above, this is just a theoretical relationship. $\gamma_0=V(X_i)=\sigma^2$ is estimated by (9). Ideally, the estimator of $\gamma_k=Cov(X_i,X_{k+i})$ is obtained by replacing all population means by sample means:

(11) $\hat{\gamma}_k=\frac{1}{n}\sum_{i=1}^n(X_i-\bar{X})(X_{k+i}-\bar{X}).$

There are two problems with this estimator, though. The first problem is that when $i$ runs from $1$ to $n,$ $k+i$ runs from $k+1$ to $k+n.$ To exclude out-of-sample values, the summation in (11) is reduced:

(12) $\hat{\gamma}_k=\frac{1}{n-k}\sum_{i=1}^{n-k}(X_i-\bar{X})(X_{k+i}-\bar{X}).$

The second problem is that the sum in (12) becomes too small when $k$ is close to $n.$ For example, for $k=n-1$ (12) contains just one term (there is no averaging). Therefore the upper limit of summation $n-1$ in (10) is replaced by some function $M(n)$ that tends to infinity slower than $n.$ The result is the estimator

$\hat{V}=\frac{1}{n}\hat{\gamma}_0+\frac{2}{n}\sum_{k=1}^{M(n)}(1-\frac{k}{M(n)})\hat{\gamma}_k$

where $\hat{\gamma}_0$ is given by (9) and $\hat{\gamma}_k$ is given by (12). This is almost the Newey-West estimator from p.152. The only difference is that instead of $\frac{k}{M(n)}$ they use $\frac{k}{M(n)+1}$, and I have no idea why. One explanation is that for low $n$, $M(n)$ can be zero, so they just wanted to avoid division by zero.