2  The Method of Maximum Likelihood

If we make the assumption that the error terms are normally distributed, the maximum likelihood estimators (MLE) coincide with the least square estimators. But MLE can also be applied to a wide variety of models other than regression models, and it generally generates estimators with excellent asymptotic properties. The major disadvantage of MLE is that it requires stronger distributional assumptions than does the method of moments.

2.1 Basic Concepts

Maximum likelihood estimation is to find the set of parameters which makes the current sample most likely given the statistical model.

Suppose we have a sample of \(n\) independent and identically distributed (IID) observations. Each of them comes from some distribution function \(f(\cdot, {\symbf{\theta)}}\), where parameters \({\symbf{\theta}}\) is fixed. The joint distribution of all the data points would be

\[ f(x_1, x_2, \dots, x_n | \theta) = f(x_1 | \theta) \times f(x_2 | \theta) \times \dots \times f(x_n | \theta). \tag{2.1}\]

It is referred to as the likelihood function of the model for the given data set.

Then it’s natural to estimate \(\theta\) by picking the \(\theta\) that maximize this joint distribution function. A parameter vector \(\hat {\symbf{\theta}}\) at which the likelihood takes on its maximum value is called a maximum likelihood estimate, or MLE, of the parameters.

Usually the log form of the likelihood function is preferred for computational purposes.

2.2 MLE for a linear model

Consider the classical normal linear model:

\[ {\symbf{y=X\beta+u, \quad u \sim N(0, \sigma^2 I) }} \tag{2.2}\]

In this case, we have two parameters to estimate, \(\sigma\) and \({\symbf{\beta}}\). The distribution of \({\symbf{y | X}}\) is

\[ f({{\symbf{y}}} \mid {{\symbf{X}}}, \beta, \sigma) = (2 \pi \sigma^2)^{-n/2} \exp\left(- \frac{({{\symbf{y- X \beta}}})'({{\symbf{y- X \beta}}})}{2 \sigma^2}\right) \tag{2.3}\]

The log-likelihood function is

\[ l({{\symbf{y, \beta, \sigma}}}) = -\frac{n}{2} \log(2 \pi) - \frac{n}{2} \log(\sigma^2) - \frac{1}{2 \sigma^2} {\symbf{(y-X \beta)'(y-X \beta) }} \tag{2.4}\]

Maximizing this function gives exactly the OLS estimator for \({\symbf{\beta}}\). That is algebra, and it holds whatever the true error distribution happens to be: the Gaussian log-likelihood is a decreasing function of the sum of squared residuals, so whatever minimizes one maximizes the other. For \(\sigma^2\) the MLE divides by \(n\) rather than \(n-k\), so it differs in finite samples and agrees asymptotically. What normality buys is not the formula but its standing. Under normality the OLS estimator is the maximum likelihood estimator and the model-based variance is valid. Without normality the same formula is a quasi-MLE: still consistent for \({\symbf{\beta}}\) under the usual conditions, but its variance needs the sandwich correction discussed below.

2.3 Asymptotic Properties of MLE

  1. Consistency \[ {{\mathrm{plim}}} ({\symbf{\hat \theta)=\theta. }} \tag{2.5}\]

This is to say that MLE estimator can get arbitrarily close to the true parameter if the sample size gets to infinity.

  1. Asymptotic Normality \[ {{\symbf{\sqrt{n}(\hat \theta - \theta)}}} \xrightarrow{d} N({\symbf{0, I^{-1}(\theta)), }} \tag{2.6}\] where \({\symbf{I(\theta)}}\) below is the per-observation information. Equivalently, in finite-sample terms, \[ {{\symbf{\hat \theta}}} \approx N({\symbf{\theta, I_n^{-1}(\theta)), \qquad I_n(\theta) = n\, I(\theta), }} \tag{2.7}\] with \({\symbf{I_n(\theta)}}\) the full-sample information. The \(\sqrt{n}\) scaling (equivalently, dividing the full-sample information by \(n\)) is what makes the statement well-defined; writing \(\hat\theta \sim N(\theta, I^{-1}(\theta))\) without specifying which information is meant is ambiguous.

This states that the asymptotic distribution of \({\symbf{\hat \theta}}\) is normal with mean \({\symbf{\theta}}\) and variance given by the inverse of the information, where the per-observation information matrix \({\symbf{I(\theta)}}\) is defined using the single-observation log-likelihood contribution \(l_t\) (so that the full-sample log-likelihood is \(l=\sum_{t=1}^n l_t\)):

\[ {{\symbf{I(\theta)}}}=E[(\frac{\partial l_t}{\partial \theta})(\frac{\partial l_t}{\partial \theta})']=-E[(\frac{\partial^2 l_t}{\partial \theta \partial \theta'})] \tag{2.8}\]

The information matrix is the expected value of the outer product of the gradient of a single observation’s log-likelihood contribution, or the negative value of the expected value of its Hessian (second derivative). Using the full-sample \(l\) here instead of \(l_t\) would give the full-sample information \(I_n(\theta) = n\,I(\theta)\), not \(I(\theta)\) itself.

  1. Asymptotic efficiency.

If \({\symbf{\hat \theta}}\) is the MLE estimator of \(\theta\) and \({\symbf{V}}\) denotes its asymptotic variance matrix – the variance of the limiting distribution of \(\sqrt n (\hat \theta - \theta)\), not of \({\symbf{\hat \theta}}\) itself, the two differing by a factor of \(n\) exactly as with the information matrix above – then \[ \sqrt n (\hat \theta -\theta) \rightarrow^d N({\symbf{0, V), \qquad V = I^{-1}(\theta). }} \tag{2.9}\]

If \({\symbf{\tilde V}}\) denotes the asymptotic variance matrix of any other regular consistent, asymptotically normal estimator, then \({\symbf{\tilde V- V}}\) is a positive semidefinite matrix. That is, the MLE is the best estimator, in terms of asymptotic variance, in that class. The regularity qualifier is not pedantry: without it the statement is false, since superefficient estimators such as Hodges’ can beat the bound at a single point of the parameter space, at the cost of much worse behaviour in a neighbourhood of it.

  1. Invariance.

If \(\hat \theta\) is the MLE of \(\theta\) and \(g(\theta)\) is a continuous function of \(\theta\), then \(g(\hat \theta)\) is the MLE of \(g(\theta)\).

2.4 When the Model Is Wrong: Quasi-MLE and M-Estimation

2.4.1 What MLE Actually Minimizes

The asymptotic properties above assume that the true density belongs to the parametric family \(f(y \mid \theta)\). In practice this is rarely literally true. What does MLE estimate when the model is wrong?

Write \(g(y)\) for the true density and \(f(y \mid \theta)\) for the parametric model. Maximizing the log-likelihood is equivalent to minimizing the Kullback-Leibler divergence from the true density to the model: \[ \mathrm{KL}\bigl(g \,\|\, f(\cdot \mid \theta)\bigr) = \int g(y) \log \frac{g(y)}{f(y \mid \theta)}\, dy = E_g\!\left[\log g(Y)\right] - E_g\!\left[\log f(Y \mid \theta)\right]. \tag{2.10}\]

The first term does not depend on \(\theta\), so minimizing KL over \(\theta\) is the same as maximizing \(E_g[\log f(Y \mid \theta)]\), which is the population version of the sample log-likelihood. The MLE converges to the value \(\theta^*\) that makes \(f(\cdot \mid \theta)\) closest to \(g\) in the KL sense, whether or not \(g\) belongs to the family. This \(\theta^*\) is called the pseudo-true value.

2.4.2 The Information Matrix Inequality

Under correct specification, the two forms of the information matrix are equal: \[ J(\theta) = E\!\left[ \frac{\partial l_t}{\partial \theta} \frac{\partial l_t}{\partial \theta}' \right] = -E\!\left[ \frac{\partial^2 l_t}{\partial \theta \,\partial \theta'} \right] = H(\theta). \tag{2.11}\]

This is the information matrix equality. Under misspecification it fails: \(J(\theta^*) \neq H(\theta^*)\) in general. The asymptotic variance of the MLE is no longer \(I^{-1}(\theta)\) but the sandwich \[ V = H(\theta^*)^{-1}\, J(\theta^*)\, H(\theta^*)^{-1}. \tag{2.12}\]

When the model is correctly specified, \(J = H\) and the sandwich collapses to \(H^{-1} = I^{-1}\), recovering the standard result. When it is not, \(H^{-1}\) is simply the wrong variance – inconsistent, rather than merely too small. There is no general ordering between \(H^{-1}\) and the sandwich: it can be too small in some parameter directions and too large in others.

2.4.3 Quasi-Maximum Likelihood Estimation

The sandwich variance makes MLE usable even under misspecification, provided we are clear about what parameter is being estimated. A quasi-maximum likelihood estimator (QMLE) is an MLE computed from a likelihood that may be wrong, together with a sandwich variance that accounts for the misspecification.

The leading case in econometrics is Poisson QMLE for count or nonnegative data. The Poisson log-likelihood for observation \(t\) is \[ l_t = y_t \log \mu_t - \mu_t - \log(y_t!), \quad \mu_t = \exp({\symbf{x}}_t'\beta). \tag{2.13}\]

The score equation \(\sum_t (y_t - \mu_t)\, {\symbf{x}}_t = 0\) depends only on the conditional mean \(E[Y_t \mid {\symbf{x}}_t] = \mu_t\), not on whether \(Y_t\) is actually Poisson. If the conditional mean is correctly specified, the QMLE \(\hat\beta\) is consistent for \(\beta\) regardless of the true distribution of \(Y_t\) — the data need not even be counts. The variance, however, must be estimated with the sandwich, since the Poisson variance assumption \(\mathrm{Var}(Y_t \mid {\symbf{x}}_t) = \mu_t\) will generally be wrong. A fuller treatment is in the Count Data chapter.

The same logic applies to logit and probit for binary data: as long as the conditional mean \(P(Y=1 \mid X) = F(X'\beta)\) is correctly specified, the MLE is consistent for \(\beta\) even if the error distribution is not exactly logistic or normal. In this sense, binary response MLE is already quasi-MLE.

2.4.4 M-Estimators

The QMLE perspective generalizes further. An M-estimator is any estimator defined as the solution to \[ \sum_{t=1}^n \psi(y_t, {\symbf{x}}_t, \theta) = 0, \tag{2.14}\]

where \(\psi\) is a known vector-valued function. MLE is the special case where \(\psi = \partial l_t / \partial \theta\), the score. OLS is the case \(\psi(y_t, {\symbf{x}}_t, \beta) = {\symbf{x}}_t(y_t - {\symbf{x}}_t'\beta)\), the population orthogonality condition from the OLS chapter. GMM generalizes further by allowing more equations than parameters; the GMM chapter develops this.

All M-estimators share the same asymptotic structure under regularity conditions: \[ \sqrt{n}\,(\hat\theta - \theta^*) \xrightarrow{d} N\!\left(0,\; A^{-1}\, B\, A^{-1\prime} \right), \tag{2.15}\]

where \(A = E[\partial \psi / \partial \theta']\) and \(B = E[\psi \psi']\). This is the sandwich again. When \(\psi\) is a score from a correctly specified likelihood, \(A = -H\), \(B = J = H\), and the sandwich reduces to \(H^{-1}\).

The M-estimator framework unifies OLS, MLE, QMLE, and GMM as special cases of the same asymptotic theory. The sandwich variance is the general formula; the simpler \(I^{-1}\) or \(\sigma^2(X'X)^{-1}\) are special cases that hold under correct specification.

2.5 Example

Let’s look at the example of regression of car’s mpg on disp, hp and wt. This time we use MLE. (R has a mle() function which I cannot make it work on this example. So I am using optim().)

Code
ols.lf <- function(theta, y, X) {
  beta <- theta[-1]
  sigma2 <- theta[1]
  # Return a large penalty rather than NA: L-BFGS-B's line search can
  # transiently evaluate points that violate the box constraint, and
  # `fn` returning NA there causes a fatal "L-BFGS-B needs finite values
  # of 'fn'" error. A finite penalty keeps the optimizer on track instead.
  if (sigma2 <= 0) return(1e10)
  n <- nrow(X)
  e <- y - X%*%beta
  logl <- ((-n/2)*log(2*pi)) - ((n/2)*log(sigma2)) - ((t(e)%*%e)/(2*sigma2))
  return(-logl)
}
X <- cbind(1,mtcars[,c('disp','hp','wt')])
y <- mtcars$mpg

# Deliberately naive starting values (sigma2 = 1, slopes at +/-1): the point
# of the exercise is that the optimizer finds the OLS solution without being
# handed it. For harder likelihoods than this one, good starting values matter
# a great deal -- they reduce the risk of converging to a spurious local
# maximum, or of failing to converge at all.
optim(c(1,1,-1,-1,-1), method="L-BFGS-B", fn=ols.lf, lower=c(1e-6,-Inf,-Inf,-Inf,-Inf), upper=rep(Inf,5), y=y, X=as.matrix(X))
$par
[1]  6.0935580702 37.1058998652 -0.0009352804 -0.0311594264 -3.8010038304

$value
[1] 74.32149

$counts
function gradient 
     126      126 

$convergence
[1] 0

$message
[1] "CONVERGENCE: REL_REDUCTION_OF_F <= FACTR*EPSMCH"
Code
# it should match the OLS estimator

lm1 <- lm(mpg~disp+hp+wt, data=mtcars)
summary(lm1)

Call:
lm(formula = mpg ~ disp + hp + wt, data = mtcars)

Residuals:
   Min     1Q Median     3Q    Max 
-3.891 -1.640 -0.172  1.061  5.861 

Coefficients:
             Estimate Std. Error t value Pr(>|t|)    
(Intercept) 37.105505   2.110815  17.579  < 2e-16 ***
disp        -0.000937   0.010350  -0.091  0.92851    
hp          -0.031157   0.011436  -2.724  0.01097 *  
wt          -3.800891   1.066191  -3.565  0.00133 ** 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 2.639 on 28 degrees of freedom
Multiple R-squared:  0.8268,    Adjusted R-squared:  0.8083 
F-statistic: 44.57 on 3 and 28 DF,  p-value: 8.65e-11

2.6 Hypotheses Testing

2.6.1 Linear Hypotheses Testing

Linear hypothesis can be framed as \[ {\symbf{H_0: \ \ R\beta -r=0, }} \tag{2.16}\] where \({\symbf{R}}\) is a \(q \times k\) matrix of known constants with \(q \le k\) and \(\mathrm{rank}({\symbf{R}}) = q\), and \({\symbf{r}}\) is a \(q\)-vector of known constants. The restrictions may number as many as the parameters – testing that every coefficient is zero is the case \(q = k\) – but they must be linearly independent.

We assume that \(u_i\) are normally distributed.

\[ {\symbf{u \sim N(0, \sigma^2 I) }} \tag{2.17}\]

Even if this assumption does not hold, we still have asymptotic normality for \({\symbf{\hat \beta}}\), so the tests below remain valid asymptotically.

Since linear combination of normal variables are also normally distributed, \[ \begin{aligned} {\symbf{\hat \beta }}&{\symbf{\sim N(\beta, \sigma^2 (X'X)^{-1})}}\\{\symbf{ R \hat \beta }}&{\symbf{\sim N(R \beta, \sigma^2 R(X'X)^{-1}R')}}\\{\symbf{ R (\hat \beta - \beta) }}&{\symbf{\sim N(0, \sigma^2 R(X'X)^{-1}R') }}\end{aligned} \tag{2.18}\]

Under null hypothesis,

\[ {\symbf{(R \hat \beta - r) \sim N(0, \sigma^2 R(X'X)^{-1}R') }} \tag{2.19}\]

Therefore, \[ {{\symbf{(R \hat \beta - r)'[\sigma^2 R(X'X)^{-1}R']^{-1} (R \hat \beta - r)}}} \sim \chi^2(q) \tag{2.20}\]

Here we don’t know \(\sigma^2\). However, it can be shown that \[ {{\symbf{\frac{\hat u' \hat u}{\sigma^2}}}} \sim \chi^2(n-k) \tag{2.21}\]

Then we have \[ {{\symbf{\frac{(R \hat \beta - r)'[ R(X'X)^{-1}R']^{-1} (R \hat \beta - r)/q}{\hat u' \hat u / (n-k)}}}} \sim F(q, n-k) \tag{2.22}\]

This is an example of the \(F\) test for any linear hypotheses testing. \(t\) test will be a special case of this.

2.6.2 The three classical tests: LR, Wald and LM

The \(F\) test above leans on normal errors. The general machinery for testing \({\symbf{H_0: R\theta - r = 0}}\) after maximum likelihood needs only the asymptotic results already established, and it comes in three forms. Write \(\hat\theta_u\) for the unrestricted MLE, \(\hat\theta_r\) for the MLE subject to the restriction, \(s(\theta) = \partial \ell / \partial \theta\) for the score, and \({\symbf{I_n(\theta) = n\,I(\theta)}}\) for the full-sample information.

Likelihood ratio. Compare the two maximized log-likelihoods: \[ LR = 2\bigl[\ell(\hat\theta_u) - \ell(\hat\theta_r)\bigr] \xrightarrow{d} \chi^2(q). \tag{2.23}\]

Wald. Ask whether the unrestricted estimate is far from satisfying the restriction, measuring distance in units of its own estimated variance: \[ W = ({{\symbf{R}}}\hat\theta_u - {{\symbf{r}}})' \bigl[{{\symbf{R\, I}}}_n^{-1}(\hat\theta_u)\,{{\symbf{R}}}'\bigr]^{-1} ({{\symbf{R}}}\hat\theta_u - {{\symbf{r}}}) \xrightarrow{d} \chi^2(q). \tag{2.24}\]

Lagrange multiplier (score). Ask whether the score, evaluated at the restricted estimate, is far from zero – if the restriction is harmless, the restricted point should already be nearly a maximum: \[ LM = s(\hat\theta_r)'\, {{\symbf{I}}}_n^{-1}(\hat\theta_r)\, s(\hat\theta_r) \xrightarrow{d} \chi^2(q). \tag{2.25}\]

The three are asymptotically equivalent under the null and have the same local power, so the choice among them is one of convenience: Wald needs only the unrestricted fit, LM needs only the restricted fit, and LR needs both. That is why LM is the natural choice for specification testing, where the restricted model is the easy one to estimate (White’s heteroskedasticity test and the Breusch-Godfrey serial-correlation test are both LM tests run as auxiliary regressions), while Wald is what software reports by default, since the unrestricted fit is what was just computed.

In the classical normal linear model the three are monotone transformations of the same \(F\) statistic above, so nothing is lost by using \(F\) there. Two cautions otherwise. In finite samples the three can disagree, sometimes enough to straddle a conventional critical value, and there is a known ordering \(W \ge LR \ge LM\) in the linear model under normality. And the Wald statistic is not invariant to nonlinear reparameterization: testing \(\gamma = 1\) and testing \(\log\gamma = 0\) are the same hypothesis but give different Wald statistics, whereas \(LR\) is invariant because it compares likelihood values, which reparameterization does not change. When a hypothesis can be written several algebraically equivalent ways, prefer \(LR\).

2.7 Test of Structural Change (Chow test)

Chow test is a test between two groups of observations. For example, we have data on consumption function of prewar period and postwar period. It is natural to think of a test on whether consumption function parameters differ between prewar and postwar periods. The null hypothesis is that there is no difference.

Let \({\symbf{y_i}}\), \({\symbf{X_i}}\) (\(i=1,2)\) indicate the appropriate partitioning of the data. The unrestricted model may be written

\[{\symbf{}}\begin{bmatrix}{\symbf{y_1 }}\\{\symbf{ y_2 }}\end{bmatrix}= \begin{bmatrix}{\symbf{X_1 }}&{\symbf{ 0 }}\\{\symbf{ 0 }}&{\symbf{ X_2 }}\end{bmatrix} \begin{bmatrix}{\symbf{\beta_1 }}\\{\symbf{ \beta_2 }}\end{bmatrix} +u \quad u \sim N(0, \sigma^2I) \tag{2.26}\]

The null hypothesis of no structural break is

\[ {\symbf{H_0: \ \ \beta_1 = \beta_2. }} \tag{2.27}\]

Running OLS on two equations separately, we have

\[{\symbf{}}\begin{bmatrix}{\symbf{\hat \beta_1 }}\\{\symbf{ \hat \beta_2 }}\end{bmatrix}= \begin{bmatrix}{\symbf{X_1' X_1 }}&{\symbf{ 0 }}\\{\symbf{ 0 }}&{\symbf{ X_2' X_2 }}\end{bmatrix}^{-1} \begin{bmatrix}{\symbf{X_1' y_1 }}\\{\symbf{ X_2' y_2 }}\end{bmatrix} =\begin{bmatrix}{\symbf{(X_1' X_1)^{-1}X_1'y_1 }}\\{\symbf{ (X_2' X_2)^{-1} X_2' y_2 }}\end{bmatrix} \tag{2.28}\]

Restricted model under null hypothesis

\[{\symbf{}}\begin{bmatrix}{\symbf{y_1 }}\\{\symbf{ y_2 }}\end{bmatrix}= \begin{bmatrix}{\symbf{X_1 }}\\{\symbf{ X_2 }}\end{bmatrix} {\symbf{\beta +u }} \tag{2.29}\]

The test of the null hypothesis is given by

\[ {{\symbf{F= \frac{(\hat u_*' \hat u_*- \hat u' \hat u)/k}{\hat u' \hat u/ (n-2k)}}}} \sim F(k , n-2k) \tag{2.30}\] where \(\hat u_*\) is the residual of the restricted model, \(\hat u\) is the stacked residual of two unrestricted models.

For example, for prewar period (suppose there is \(n_1\) observations):

\[ y_1 = \beta_0 + \beta_1 x_1 + \beta_2 x_2 \tag{2.31}\]

For postwar period (suppose there is \(n_2\) observations):

\[ y_2 = \gamma_0 + \gamma_1 x_1 + \gamma_2 x_2 \tag{2.32}\]

The null hypothesis of no structural break is

\[ {\symbf{H_0: \ \ \beta_0 = \gamma_0, \beta_1 = \gamma_1, \beta_2 = \gamma_2. }} \tag{2.33}\]

Running OLS on two equations separately, we have two sums of squares of error (\(SSR_1\) and \(SSR_2\)). The unrestricted error sum of squares is \[ SSR_U = SSR_1 + SSR_2 \tag{2.34}\]

Then run the regression on the stacked sample of \(n_1+n_2\) observations and get \(SSR_R\).

Then

\[ \frac{(SSR_R-SSR_U)/k}{SSR_U/(n_1+n_2-2k)} \sim F_{k, n_1+n_2-2k}. \tag{2.35}\]

\(k\) is number of restrictions; in this example, it is 3.

The other way to do the same test is easier: simply include interaction terms between group dummy and explanatory variables in the regression.

For our earlier example, we would estimate the model:

\[ y=\alpha_0 + \alpha_1 x_1 + \alpha_2 x_2 + \eta_0 d + \eta_1 x_1 d + \eta_2 x_2 d \tag{2.36}\]

Here \(d\) is a dummy variable for postwar period. The Chow test is simply a test on the hypothesis that all the coefficients involving \(d\) are zero. A regression of the above model with \(n+m\) observations and a \(F\) test are easy to do.

\[ {\symbf{H_0: \ \ \eta_0 = \eta_1 = \eta_2 = 0. }} \tag{2.37}\]

2.7.1 An example of Chow test in R

Here we use an example from the “strucchange” library.

Code
## Example 7.4 from Greene (1993), "Econometric Analysis"
## Chow test on Longley data
data("longley")
library(strucchange)
## use structural change test from the library.
sctest(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley,
  type = "Chow", point = 7)

    Chow test

data:  Employed ~ Year + GNP.deflator + GNP + Armed.Forces
F = 3.9268, p-value = 0.06307
Code
## which is equivalent to segmenting the regression via
fac <- factor(c(rep(1, 7), rep(2, 9)))
## here fac is the factor for segmenting it at point 7.
fm0 <- lm(Employed ~ Year + GNP.deflator + GNP + Armed.Forces, data = longley)
fm1 <- lm(Employed ~ fac/(Year + GNP.deflator + GNP + Armed.Forces), data = longley)
## Here anova is returning the F test (Chow test). Equivalent to sctest results.
anova(fm0, fm1)
Analysis of Variance Table

Model 1: Employed ~ Year + GNP.deflator + GNP + Armed.Forces
Model 2: Employed ~ fac/(Year + GNP.deflator + GNP + Armed.Forces)
  Res.Df    RSS Df Sum of Sq      F  Pr(>F)  
1     11 4.8987                              
2      6 1.1466  5    3.7521 3.9268 0.06307 .
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Code
## estimates from Table 7.5 in Greene (1993)
summary(fm0)

Call:
lm(formula = Employed ~ Year + GNP.deflator + GNP + Armed.Forces, 
    data = longley)

Residuals:
    Min      1Q  Median      3Q     Max 
-0.9058 -0.3427 -0.1076  0.2168  1.4377 

Coefficients:
               Estimate Std. Error t value Pr(>|t|)   
(Intercept)   1.169e+03  8.359e+02   1.399  0.18949   
Year         -5.765e-01  4.335e-01  -1.330  0.21049   
GNP.deflator -1.977e-02  1.389e-01  -0.142  0.88940   
GNP           6.439e-02  1.995e-02   3.227  0.00805 **
Armed.Forces -1.015e-04  3.086e-03  -0.033  0.97436   
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.6673 on 11 degrees of freedom
Multiple R-squared:  0.9735,    Adjusted R-squared:  0.9639 
F-statistic: 101.1 on 4 and 11 DF,  p-value: 1.346e-08
Code
summary(fm1)

Call:
lm(formula = Employed ~ fac/(Year + GNP.deflator + GNP + Armed.Forces), 
    data = longley)

Residuals:
     Min       1Q   Median       3Q      Max 
-0.47717 -0.18950  0.02089  0.14836  0.56493 

Coefficients:
                    Estimate Std. Error t value Pr(>|t|)   
(Intercept)        1.678e+03  9.390e+02   1.787  0.12413   
fac2               2.098e+03  1.786e+03   1.174  0.28473   
fac1:Year         -8.352e-01  4.847e-01  -1.723  0.13563   
fac2:Year         -1.914e+00  7.913e-01  -2.419  0.05194 . 
fac1:GNP.deflator -1.633e-01  1.762e-01  -0.927  0.38974   
fac2:GNP.deflator -4.247e-02  2.238e-01  -0.190  0.85576   
fac1:GNP           9.481e-02  3.815e-02   2.485  0.04747 * 
fac2:GNP           1.123e-01  2.269e-02   4.951  0.00258 **
fac1:Armed.Forces -2.467e-03  6.965e-03  -0.354  0.73532   
fac2:Armed.Forces -2.579e-02  1.259e-02  -2.049  0.08635 . 
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 0.4372 on 6 degrees of freedom
Multiple R-squared:  0.9938,    Adjusted R-squared:  0.9845 
F-statistic: 106.9 on 9 and 6 DF,  p-value: 6.28e-06

2.8 Heteroskedasticity and Autocorrelation Consistent Standard Errors

2.8.1 Variance estimator under homoscedasticity

In OLS regression, the variance-covariance matrix of \(\hat \beta\) is \[{{\mathrm{var}}} {\symbf{(\hat \beta) = {E}[(\hat \beta-\beta)(\hat \beta -\beta)'] = {E}[(X'X)^{-1}X'uu'X(X'X)^{-1}] = \sigma^2 (X'X)^{-1} }} \tag{2.38}\]

if \[{{\mathrm{var}}} {\symbf{(u)=\sigma^2 I}}\] {#eq-mle-33}.

That is, the error term has mean zero and constant variance (homoscedasticity). The pairwise correlation between error terms is always zero (no serial correlation).

The estimation of \(\sigma^2\):

\[ s^2=\frac{ {\symbf{\hat u' \hat u}}}{n-k} \tag{2.39}\] is an unbiased estimator of \(\sigma^2\) (proof omitted).

The standard estimate of the variance-covariance matrix of the OLS parameter estimates under the assumption of IID errors is \[ {{\mathrm{\hat {Var}}}}(\hat \beta)=s^2 {\symbf{(X'X)^{-1} }} \tag{2.40}\]

2.8.2 White’s estimator

We made strong assumption that the error terms of the regression model are IID when we estimate the variance-covariance matrix of OLS estimator. Under this assumption, the usual estimator of variance-covariance matrix of \({\symbf{\hat \beta}}\) is consistent. Now let’s relax this assumption to only independent but not identically distributed. Again, the linear regression models is

\[ {\symbf{y=X\beta+u, \quad {E} (u)=0, \quad {E} (u u')=\Omega, }} \tag{2.41}\] where \({\symbf{\Omega}}\) is the error variance-covariance matrix with diagonal elements being \(\sigma_t^2\) for \(t^{th}\) element, off-diagonal elements being zero. In other words, the error terms are heteroscedastic.

The variance-covariance matrix of the OLS estimator \({\symbf{\hat \beta}}\) is equal to \[ \begin{aligned} {{\mathrm{Var}}} {\symbf{(\hat \beta) }}&{\symbf{= {E}[(\hat \beta -\beta)(\hat \beta -\beta)'] }}\\{\symbf{ }}&{\symbf{= [(X'X)^{-1}X'({E}(uu'))X(X'X)^{-1}] }}\\{\symbf{ }}&{\symbf{= (X'X)^{-1} X' \Omega X (X'X)^{-1} }}\end{aligned} \tag{2.42}\]

If we know \(\sigma_t^2\), then we would be able to estimate this “sandwich covariance matrix”. But we don’t. \[ {{\mathrm{Var}}} {\symbf{(\hat \beta) = \frac{1}{n} [\frac{1}{n}(X'X)]^{-1}[\frac{1}{n}X'\Omega X][\frac{1}{n}(X'X)]^{-1} }} \tag{2.43}\]

Let \(y_t\) denote the \(t\)th observation on the dependent variable, and \(x_t'=[1 x_{2t} \cdots x_{kt}]\) denote the \(t\)th row of the \({\symbf{X}}\) matrix. Then \[ {\symbf{X' \Omega X=\sum_{t=1}^n \sigma_t^2 x_t x_t' }} \tag{2.44}\]

The White estimator replaces the unknown \(\sigma_t^2\) by \(\hat u_t^2\), the estimated OLS residuals. This provides a consistent estimator of the variance matrix for the OLS coefficient vector and is particularly useful since it does not require any specific assumptions about the form of the heteroscedasticity.

Therefore, \[ \begin{aligned} \hat {{\mathrm{Var}}} {\symbf{(\hat \beta) }}&{\symbf{= \frac{1}{n} [\frac{1}{n}(X'X)]^{-1}[\frac{1}{n}X' \hat \Omega X][\frac{1}{n}(X'X)]^{-1}}}\\{\symbf{ \hat \Omega }}&{\symbf{= {diag} ({\hat u_1^2, \hat u_2^2, \cdots, \hat u_n^2}) }}\end{aligned} \tag{2.45}\]

2.8.3 Newey-West estimator

White’s estimator deals with the situation that we have heteroskedasticity (a diagonal \(\Omega\)) of unknown form. When we have serial correlation of unknown form (a non-diagonal \(\Omega\)), we can estimate the variance-covariance matrix by a heteroskedasticity and autocorrelation consistent, or HAC, estimator. Newey-West estimator is the most popular HAC estimator.

Given a time series data set, suppose we are interested in estimating the mean vector (suppose we have more than one variable) and its variance. We know that given IID data, we can apply central limit theorem: sample mean is a consistent estimator of the population mean and it’s variance can be calculated since asymptotically the sample mean conforms to a normal distribution and the variance can be estimated, relatively easily. However, in the case of time series data, autocorrelation usually exists. We may be concerned the CLT may not work in this case.

Fortunately, autocorrelation does not by itself defeat inference, though the conditions need care. Suppose \({\symbf{y_t}}\) is covariance-stationary (the covariance is not a function of time) and its autocovariances are absolutely summable, \(\sum_{v=-\infty}^{\infty} \lVert \Gamma_v \rVert < \infty\). Then, as in Hamilton (1994), the sample mean satisfies:

\[{\symbf{\bar y_t \to \mu , }} \tag{2.46}\] \[ {{\symbf{S}}} = \lim_{T \to \infty} {\symbf{ {T \cdot E[(\bar y_T - \mu)(\bar y_T -\mu)' ]} = \sum_{v=-\infty}^{\infty} \Gamma_v . }} \tag{2.47}\] where \({\symbf{\Gamma_v}}\) is the variance-covariance matrix for \({\symbf{y_t}}\) and \({\symbf{y_{t-v}}}\).

The first one says the law of large numbers still holds. The second gives the long-run variance used for the standard error, and absolute summability is what makes that sum exist.

Covariance stationarity on its own is not enough for either statement. It can fail even the law of large numbers. Let \(y_t = z + \varepsilon_t\), where \(z\) is drawn once and then held fixed and \(\varepsilon_t\) is white noise. Every autocovariance equals \(\mathrm{Var}(z)\), so the process is covariance-stationary, the autocovariances are not summable, and \(\bar y_T\) converges to \(z\) rather than to \(\mu\). Asymptotic normality asks for more again: a mixing, near-epoch dependence, or martingale-difference condition, together with moment restrictions. Covariance stationarity buys the variance formula, not the central limit theorem.

If the data were generated by a vector MA(q) process, then

\[ {{\symbf{S}}} = \sum_{v=-q}^{q} \Gamma_v . \tag{2.48}\]

A natural estimate is

\[ {\symbf{\hat S = \hat \Gamma_0 + \sum_{v=1}^{q} (\hat \Gamma_v + \hat \Gamma_v' ),}} \tag{2.49}\]

where \[ {\symbf{\hat \Gamma_v = (1/T) \sum_{t=v+1}^{T} (y_t- \bar y)(y_{t-v} - \bar y)'. }} \tag{2.50}\]

This gives a consistent estimate of \({\symbf{S}}\); however, it sometimes is not positive semidefinite.

Newey-West (1987) suggested putting in a weight:

\[ {{\symbf{\hat S = \hat \Gamma_0}}} + \sum_{v=1}^{q} {(1- \frac{v}{q+1})} ({\symbf{\hat \Gamma_v + \hat \Gamma_v' ), }} \tag{2.51}\] Here \(q\) is a truncation bandwidth, not a true MA order. For an MA(\(q\)) process the two coincide, but the Newey-West estimator is used precisely when the dependence has no known finite order: the Bartlett weights \(1 - v/(q+1)\) downweight higher lags and keep \(\hat S\) positive semidefinite, and consistency comes from letting \(q\) grow with \(T\), slowly enough that the poorly estimated high-order autocovariances do not dominate.

Consider a linear regression model: \[ y_t={ {\symbf{x_t' \beta}}} + u_t \tag{2.52}\]

Suppose we have the OLS estimator \({\symbf{b_T}}\), then \[ \sqrt{T} ({{\symbf{b_T - \beta}}}) = [(1/T) {\sum_{t=1}^T {\symbf{x_t x_t'}}}]^{-1} [(1/{\sqrt{T}}) {\sum_{t=1}^{T} {\symbf{x_t u_t}}}] \tag{2.53}\]

The first term converges in probability to some constant. The second term is \(\sqrt{T}\) times the sample mean of the vector \({\symbf{x_t u_t}}\), which is exactly the form to which a central limit theorem applies.

Under general conditions,

\[ \sqrt{T} ({{\symbf{b_T - \beta}}}) \rightarrow^L N(0, Q^{-1}SQ^{-1}) \tag{2.54}\]

where \(Q = {{\mathrm{plim}}} \, (1/T)\sum_{t=1}^T {{\symbf{x_t x_t'}}} = {{\mathrm{E}}}[{{\symbf{x_t x_t'}}}]\), and \(S\) can be estimated by \[ {{\symbf{\hat S_T = \hat \Gamma_{0T}}}} + \sum_{v=1}^{q} {(1- \frac{v}{q+1})} ({\symbf{\hat \Gamma_{v,T} + \hat \Gamma_{v,T}' ), }} \tag{2.55}\] where \[ \hat \Gamma_{v,T}= (1/T) \sum_{t=v+1}^T (x_t \hat u_{t, T} \hat u_{t-v, T} x_{t-v}'), \tag{2.56}\] where \(\hat u_{t,T}\) is the OLS residual for data \(t\) in a sample of size \(T\).

Overall, the variance of \({\symbf{b_T}}\) is approximated by

\[\hat \Sigma_{NW} = [\sum_{t=1}^T x_t x_t']^{-1} [ \sum_{t=1}^T \hat u_t^2 x_t x_t' + \sum_{v=1}^{q} {(1- \frac{v}{q+1})} \sum_{t=v+1}^T (x_t \hat u_{t, T} \hat u_{t-v, T} x_{t-v}' + x_{t-v} \hat u_{t-v, T} \hat u_{t, T} x_{t}') ] [\sum_{t=1}^T x_t x_t']^{-1} \tag{2.57}\]

This estimation obviously depends on the selection of \(q\), the lag length beyond which the autocorrelation of \(x_t u_t\) and \(x_{t-v} u_{t-v}\) is treated as negligible. One common rule of thumb sets \(q = 0.75 \cdot T^{\frac{1}{3}}\); it is a convention rather than a theorem, and other growth rates are in use. Newey-West (1994) has suggested a way to automatically select the bandwidth \(q\). Here we omitted the discussion. Both Stata and R now also implement Newey-West (1994) estimator, with no need to specify \(q\).