Unit7 Autocorrelation
Unit7 Autocorrelation
Autocorrelation
María José Olmo Jiménez
Econometrics
Contents
1 The nature of autocorrelation 2
2 Detection of autocorrelation 4
2.1 Informal methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Formal methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Remedial measures 9
3.1 When ρ is known . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 When ρ is unknown . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Serial Correlation-Robust Inference after OLS . . . . . . . . . . . . . . . . . . 11
1
1 The nature of autocorrelation
Introduction
Assumption of no autocorrelation in the LRM:
Cov(ui , uj ) = 0, ∀i, j = 1, . . . , n, i 6= j
But sometimes there is a dependence between the error terms so we have autocorrelation or
serial correlation. Symbolically,
Cov(ui , uj ) 6= 0,
i, j = 1, . . . , n, i 6= j
⇓
Autocorrelated model: y = Xβ β + u with
σ2 σ12 ··· σ1n
σ12 σ2 ··· σ2n
V (u) = V = .. .. .. ..
. . . .
σ1n σ2n ... σ2
• This situation is more common in time series data than in cross-sectional data.
• All the error terms have the same variance (we retain all the other assumptions of the
classical model).
• The error terms are no independent.
Causes of autocorrelation
Consequences of autocorrelation
• The OLS estimators although linear, unbiased and consistent, do not have minimum
variance (they are not BLUE).
• The estimator σ 2 is biased.
• The usual OLS standard errors and test statistics are not valid, even asymptotically. So,
one shouldn’t use OLS because the conclusions are not reliable.
2
Autocorrelation scheme
The elements of the diagonal of the matrix
σ2 σ12 ··· σ1n
σ12 σ2 ··· σ2n
V= .. .. .. ..
. . . .
σ1n σ2n ... σ2
n(n − 1)
(k + 1) + 1 +
2
and this is impossible!!
To make any headway, we must assume the mechanism that generates ut , since Cov(ut , us ) 6=
0 (t 6= s) is too general an assumption to be of any practical use. As a starting point one can
assume that the error terms are generated by the following mechanism
where ρ is known as the coefficient of autocorrelation and where εt is the stochastic dis-
turbance term such that it satisfied the standard OLS assumptions, namely,
• E(εt ) = 0
• V ar(εt ) = σε2
• Cov(εt , εs ) = 0, ∀t, s = 1, . . . , n, t 6= s
• E(ut ) = 0, ∀t = 1, . . . , n
σε2
• V ar(ut ) = σ 2 = 1−ρ2
, ∀t = 1, . . . , n
3
Then, the variance-covariance matrix of u is
σ2 ρσ 2 ρ2 σ 2 ··· ρn−1 σ 2
ρσ 2 σ2 ρσ 2 ··· ρn−2 σ 2
V= .. .. .. .. ..
. . . . .
ρn−1 σ 2 ρn−2 σ 2 ρn−3 σ 2 ... σ2
1 ρ ρ2 ··· ρn−1
2
ρ 1 ρ ··· ρn−2
= σ 2Ω
=σ .. .. .. .. ..
. . . . .
ρn−1 ρn−2 ρn−3 ... 1
2 Detection of autocorrelation
There are several diagnostic tools to detect autocorrelation. They are classified as:
• Informal methods
• Formal methods
1. We can simply plot them against time, the time sequence plot (see Figure 1).
3. We can plot the PACF of the residuals as a bar plot against the lag length (see Figure
3). For no autocorrelation, the bars should be inside the confidence interval for all lags.
4
Figure 1: Patterns of positive (on the left) and negative (on the right) serial correlation.
Figure 2: Patterns of positive (on the left) and negative (on the right) serial correlation.
Example 1
This table contains information about the sales of a company, Y , in millions of dollars,
and the industry-wide sales, X, in millions of dollars, along the past 16 quarters:
t Xt Yt t Xt Yt
1 270.36 44.84 9 290.58 48.13
2 258.38 42.97 10 290.18 47.95
3 254.96 41.98 11 296.72 49.10
4 259.70 42.75 12 292.32 48.52
5 265.40 43.95 13 301.72 50.22
6 274.98 45.65 14 305.42 51.15
7 281.86 46.87 15 314.96 52.78
8 285.78 47.35 16 321.10 53.91
Estimate the LRM Yt = β0 + β1 Xt + ut by OLS and examine the residual plots to find out if
there is serial correlation of first order.
5
Figure 3: Partial correlogram of the residuals
• Durbin-Watson test
• Breusch-Godfrey test
Durbin-Watson test
H0 : ρ = 0
H1 : ρ 6= 0
Intuitively,
6
– an intermediate value of d shows no correlation of first order.
Then,
– If ρb = 1 ⇒ d ∼
=0
– If ρb = 0 ⇒ d ∼
=2
– If ρb = −1 ⇒ d ∼
=4
and hence,
0.d.4
• Durbin and Watson determined the critical dL and dU values for the given sample size,
number of explanatory variables and α, in such a way that:
H0 : No positive autocorrelation
H0∗ : No negative autocorrelation
• Durbin-Watson test has some drawbacks:
– If the model has no intercept, it is essential to rerun the regression including the
intercept term to obtain the RSS.
– It cannot be used to detect higher-order autoregressive schemes.
– The error term ut is assumed to be normally distributed.
– This test is inapplicable in models that include lagged value(s) of the dependent
variable as one of the explanatory variables.
– It cannot be used if there are missing observations in the data.
– If it falls in the indecisive zone, one cannot conclude that (first-order) autocorrela-
tion does or does not exist.
7
Example 1 (continuation)
We apply Durbin-Watson test to the model in Example 1.
t u
bt (u bt−1 )2
bt − u t u
bt (u bt−1 )2
bt − u
1 0.090384 9 -0.188671 0.004523
2 0.334988 0.059831 10 -0.298067 0.011967
3 -0.051344 0.149252 11 -0.302449 0.000019
4 -0.118007 0.004444 12 -0.105800 0.038671
5 0.075880 0.037592 13 -0.065005 0.001664
6 0.084903 0.000081 14 0.211904 0.076679
7 0.090506 0.000031 15 0.157987 0.002907
8 -0.121417 0.044911 16 0.204209 0.002136
Total 0.434711
Durbin-Watson d statistics is
n
bt−1 )2
bt − u
P
(u
t=2 0.434711
d= n = = 0.842874
P
b2t
u 0.515748
t=1
Breusch-Godfrey test
To avoid some of the pitfalls of the Durbin-Watson test of autocorrelation, statisticians
Breusch and Godfrey have developed a test of autocorrelation that is general in the sense that
it allows for (1) such as the lagged values of the regressand; (2) higher-order autoregressive
schemes (AR(2), AR(3), . . .)
• It assumes that the error term ut follows the pth−order autoregressive scheme as follows:
ut = ρ1 ut−1 + ρ2 ut−2 + . . . + ρp ut−p + εt
)
H0 : ρ1 = . . . = ρp = 0
H1 : Any ρj 6= 0, j = 1, . . . , p
• Test statistic:
L = (n − p)R2
where R2 is the coefficient of determination of the auxiliary regression
u
bt = β0 + β1 X1t + . . . + βk Xkt + ρ1 u
bt−1 + ρ2 u
bt−2 + . . . + ρp u
bt−p + εt
Remark: In Gretl this test is implemented using the exact distribution of the test statistic L
(LMF test or Lagrange Multiplier F-test).
8
Example 1 (continuation)
We apply Breusch-Godfrey test to find out if there is first-order autocorrelation in the
model of Example 1. For this p = 1 and the auxiliary regression is given by:
Since Lexp > χ21;0.95 = 3.84146, one can reject H0 at 5% significance level, so there is
first-order autocorrelation in the model.
3 Remedial measures
If after applying one or more of the diagnostic tests of autocorrelation discussed in the previous
section, we find that there is autocorrelation, what then? We have three options:
• When ρ is known
• When ρ is unknown
• Estimate the model by OLS correcting the standard errors for fairly arbitrary forms of
serial correlation.
Yt∗ = β0 X0t
∗ ∗
+ β1 X1t ∗
+ . . . + βk Xkt + u∗t , t = 1, . . . , n (1)
where
q
Y1∗ = 1 − ρ2 Y1 , Yt∗ = Yt − ρYt−1 , t≥2
q
∗ ∗
X11 = 1 − ρ2 , X1t = 1 − ρ, t≥2
q
∗ ∗
Xj1 = 1 − ρ2 Xj−1,1 , Xjt = Xj−1,t − ρXj−1,t−1 , t ≥ 2, j = 2, . . . , k + 1
9
3.2 When ρ is unknown
The parameter ρ is rarely known in practice. Therefore, we need to find ways of estimating ρ.
We have several possibilities:
• Cochrane-Orcutt method
• Prais-Winsten method
• Hildreth-Lu method
In any case, once ρb has been obtained, the regression coefficients β0 , β1 , . . ., βk can be
estimated by FGLS (that is, they are estimated by OLS in the transformed model).
The transformed model is the same as in (1), but replacing ρ by ρb.
Example 1 (continuation)
As ρ is unknown, we can estimate it from the value of Durbin-Watson statistics d:
d
ρb = 1 − = 0.578563.
2
10
Then, the values of the variables in the transformed model are:
∗ ∗ ∗
t Xt Yt X1t
√ √ X2t √ Yt
1 270.36 44.84 0.8156377= 1 − 0.5785632 220.5158= 1 − 0.5785632 X1 36.57319= 1 − 0.5785632 Y1
2 258.38 42.97 0.4214370=1-0.578563 101.9597=X2 − 0.578563X1 17.02724=Y2 − 0.578563Y1
3 254.96 41.98 0.4214370=1-0.578563 105.4709=X3 − 0.578563X2 17.11915=Y3 − 0.578563Y2
4 259.70 42.75 0.4214370=1-0.578563 112.1896=X4 − 0.578563X3 18.46193=Y4 − 0.578563Y3
5 265.40 43.95 0.4214370=1-0.578563 115.1472=X5 − 0.578563X4 19.21643=Y5 − 0.578563Y4
6 274.98 45.65 0.4214370=1-0.578563 121.4294=X6 − 0.578563X5 20.22216=Y6 − 0.578563Y5
7 281.86 46.87 0.4214370=1-0.578563 122.7667=X7 − 0.578563X6 20.45860=Y7 − 0.578563Y6
8 285.78 47.35 0.4214370=1-0.578563 122.7062=X8 − 0.578563X7 20.23275=Y8 − 0.578563Y7
9 290.58 48.13 0.4214370=1-0.578563 125.2383=X9 − 0.578563X8 20.73504=Y9 − 0.578563Y8
10 290.18 47.95 0.4214370=1-0.578563 122.0612=X10 − 0.578563X9 20.10376=Y10 − 0.578563Y9
11 296.72 49.10 0.4214370=1-0.578563 128.8326=X11 − 0.578563X10 21.35790=Y11 − 0.578563Y10
12 292.32 48.52 0.4214370=1-0.578563 120.6488=X12 − 0.578563X11 20.11256=Y12 − 0.578563Y11
13 301.72 50.22 0.4214370=1-0.578563 132.5945=X13 − 0.578563X12 22.14812=Y13 − 0.578563Y12
14 305.42 51.15 0.4214370=1-0.578563 130.8560=X14 − 0.578563X13 22.09457=Y14 − 0.578563Y13
15 314.96 52.78 0.4214370=1-0.578563 138.2553=X15 − 0.578563X14 23.18650=Y15 − 0.578563Y14
16 321.10 53.91 0.4214370=1-0.578563 138.8758=X16 − 0.578563X15 23.37344=Y16 − 0.578563Y15
From these values, we can estimate the regression coefficients of the model
Yt∗ = β0 X1t
∗ ∗
+ β1 X2t + u∗t
by OLS, obtaining βb0 = −3.02293 and βb1 = 0.17676. These are the FGLS estimates of the
regression coefficients in the initial model. Therefore, the fitted regression equation by FGLS
is
Ybt = −3.02293 + 0.17676Xt .
In addition, it can be checked that this model has no autocorrelation (the problem has
been solved).
11