Vous êtes sur la page 1sur 37

Applied Econometric Methods I

Autocorrelation
Chapter 4.6-4.11

Stig Vinther Mller


Department of Economics and Business, Aarhus University

24/9 2014

(AEM I)

24/9 2014

1 / 37

Overview

OLS properties.
What is autocorrelation?
Consequences of autocorrelation.
Solutions.
Testing for autocorrelation.
Illustration: the demand for ice cream (In EViews).
Illustration: incomplete dynamics (EViews program).

(AEM I)

24/9 2014

2 / 37

OLS properties

Under assumptions (A1) and (A2):


I

The OLS estimator is unbiased. That is:


E fb g =

Under assumptions (A1), (A2), (A3) and (A4):


I

The variance of the OLS estimator is given by:


V fb g = 2 X 0 X

I
I

And s 2 is an unbiased estimator for 2 .


The OLS estimator is BLUE: best linear unbiased estimator for .

(AEM I)

24/9 2014

3 / 37

The covariance matrix

Under the Gauss-Markov assumptions, the covariance matrix can be


written as:
2 2
3

0
0
6 0 2
0 7
7
6
7
6
2
7
6
V fe j X g = I = 6
7
7
6
5
4
0

2 is constant along the diagonal: (A3) is satised.

Zero o-diagonal elements: (A4) is satised.

(AEM I)

24/9 2014

4 / 37

Autocorrelation

Autocorrelation (serial correlation) arises if dierent error terms are


correlated. This mostly occurs with time-series data.
When do we expect this?
I
I
I

Model is missing seasonal patterns.


Model is based on overlapping samples (e.g. quarterly returns observed
each month).
Model is otherwise misspecied (omitted variable, incorrect dynamics,
etc.).

(AEM I)

24/9 2014

5 / 37

Autocorrelation

The error term picks up the inuence of those (many) variables and
factors not included in the model.
If there is some persistence in these factors, autocorrelation may arise.
Thus, autocorrelation may be an indication of a misspecied model
(omitted variables, incorrect functional forms, incorrect dynamics).
Accordingly, autocorrelation tests are often interpreted as
misspecication tests.

(AEM I)

24/9 2014

6 / 37

Autocorrelation
Demand for ice cream explained from income and price index

(AEM I)

24/9 2014

7 / 37

Autocorrelation

Autocorrelation typically occurs with time series data (where


observations have a natural ordering).
To stress this, we shall index the observations by t = 1, ..., T rather
than i = 1, ..., N.

(AEM I)

24/9 2014

8 / 37

First-order autocorrelation

Many forms of autocorrelation exist. The most common one is


rst-order autocorrelation.
Consider:
yt = xt0 + t
where the error depends upon its lagged value:
t = t

+ t

where t is an error term with mean zero and constant variance.


Assumptions are such that the Gauss-Markov conditions arise if = 0.

(AEM I)

24/9 2014

9 / 37

Properties of the error term

To determine the properties of t , we assume jj < 1 (stationarity see


Ch. 8). Then it holds that:
E f t g = 0
and
2 = V ft g =

(AEM I)

2
1 2

24/9 2014

10 / 37

Properties of the error term


Further, the non-diagonal elements of the covariance matrix are:
2
1 2
2
cov ft , t 2 g = 2
1 2
2
cov ft , t s g = s
1 2

cov ft , t

1g

Thus, this form of autocorrelation implies that all error terms are
correlated. Their covariance decreases if the distance in time gets
large.
We see that if = 0, the non-diagonal elements of the covariance
matrix are equal to zero (no autocorrelation).

(AEM I)

24/9 2014

11 / 37

Alternative autocorrelation patterns

We have shown that the model


yt = xt0 + t
where
t = t

+ t

implies that all errors are correlated with each other, with correlations
becoming smaller if they are further apart.
Two alternatives:
I
I

Higher order patterns.


Moving average patterns.

(AEM I)

24/9 2014

12 / 37

Higher order patterns

With quarterly or monthly (macro) data, higher order patterns are possible
(due to a periodic eect). For example, with quarterly data:
t = t

+ t

or, more generally:


t = 1 t

+ 2 t

+ 3 t

+ 4 t

+ t

known as 4th order autocorrelation.

(AEM I)

24/9 2014

13 / 37

Moving average autocorrelation

Arises if the correlation between dierent error terms is limited by a


maximum time lag. Simplest case (1st order):
t = t + t
This implies that t is correlated with t
etc.

1
1,

but not with t

or t

3,

Moving average errors arise by construction when overlapping


samples are used (see the illustration in Section 4.11).

(AEM I)

24/9 2014

14 / 37

Consequences

The consequences of autocorrelation is similar to the consequences of


heteroskedasticity.
As long as E fe j X g = 0 holds, the OLS estimator is still unbiased.
However, if V fe j X g = 2 I is violated: OLS is no longer BLUE.
Routinely computed standard errors are incorrect.

This also indicates three general ways to deal with the problem:
I
I
I

Use alternative standard errors.


Use an alternative estimator (more e cient than OLS).
Reconsider the employed model (this option is often employed with
autocorrelation).

(AEM I)

24/9 2014

15 / 37

Solution 1: Computing robust standard errors

Similar to the White standard errors for heteroskedasticity, it is also


possible to correct OLS standard errors for heteroskedasticity and
autocorrelation.
Newey and West have developed a method of computing consistent
standard errors in the presence of both heteroskedasticity and
autocorrelation of unknown form.
These standard errors are called
heteroskedasticity-and-autocorrelation consistent standard errors
(HAC standard errors) or Newey-West standard errors.
In EViews we have the option to choose Newey-West standard errors.

(AEM I)

24/9 2014

16 / 37

Solution 1: Computing robust standard errors

(AEM I)

24/9 2014

17 / 37

Solution 2: Deriving an alternative estimator


Trick: we know that OLS is BLUE under the Gauss-Markov
conditions.
Transform the model such that it satises the Gauss-Markov
assumptions again, i.e. transform the model to get uncorrelated
errors.
Then apply OLS to the transformed model. This leads to the
generalized least squares (GLS) estimator.
Transformation often depends upon unknown parameters
(characterizing the form of autocorrelation).
Estimate them rst and transform as before. This leads to a feasible
GLS (FGLS, EGLS) estimator.

(AEM I)

24/9 2014

18 / 37

Solution 2: Deriving an alternative estimator


Consider:
yt = 1 + 2 xt + t
where the error depends upon its lagged value:
t = t

+ t

where t is an error term with mean zero and constant variance.


To transform the model such that it satises the Gauss-Markov
conditions we use:
yt

yt

= (1

) 1 + 2 (xt

xt

1 ) + t

With known , this produces (almost) the GLS estimator. Note: rst
observation is lost by this transformation.

(AEM I)

24/9 2014

19 / 37

Solution 2: Deriving an alternative estimator


Of course, typically is unknown. How do we obtain an estimate of
?
First we can estimate the original model yt = 1 + 2 xt + t by OLS.
This gives the OLS residuals:
et

= yt
= yt

yt

(b1 + b2 xt )

Then starting from


t = t

+ t

it seems natural to estimate by regressing the OLS residual et upon


its lag et 1 .
We now use the estimate of which leads to estimated GLS (EGLS).

(AEM I)

24/9 2014

20 / 37

Solution 3: Reconsider the employed model

Change functional form (e.g. use log(x ) rather than x), see Figure
4.5.
Extend the model by including additional explanatory variables
(seasonals) or additional lags.
In many cases, including lagged values of y and/or x will help
eliminate the serial correlation problem. We will see an example of
this below.

(AEM I)

24/9 2014

21 / 37

Testing for rst-order autocorrelation


Asymptotic tests

By regressing the OLS residual et upon its lag et


estimate as well as a standard error to it.

1,

we obtain an

The resulting t-test statistic is approximately equal to:


p
T
t
where T is the number of observations in our sample.
We reject the null (no autocorrelation) against the alternative of
nonzero autocorrelation if jt j > 1.96 (95% condence).

Another form is based on (T 1) R 2 of this regression, to be


compared with a Chi-squared distribution with 1 DF (reject if > 3.86).

(AEM I)

24/9 2014

22 / 37

Testing for rst-order autocorrelation


Asymptotic tests

Some remarks:
If we also suspect heteroskedasticity, White standard errors may be
used in the auxiliary regression.
If the model of interest contains lagged values of yt (or other
explanatory variables that may be correlated with lagged error terms),
the auxiliary regression should also include all explanatory variables
(just to make sure the distribution of the test is correct). This is
typically refered to the Breusch-Godfrey autocorrelation test. In the
BG test the origional regressors are always included in the auxiliary
regression:
et = et 1 + xt0 + t
The BG test is valid also in the case where the model does not
include lagged values of yt !
(AEM I)

24/9 2014

23 / 37

Testing for rst-order autocorrelation


Durbin-Watson test

This is a very popular test, routinely computed by most regression


packages (also if it is not appropriate!).
Requirements:
I
I

Intercept in the model.


Assumption (A2), so no lagged dep. variables!

(AEM I)

24/9 2014

24 / 37

Testing for rst-order autocorrelation


Durbin-Watson test

The test statistic is given by:


dw =

Tt=2 (et et
Tt=1 et2

1)

This is approximately equal to:


dw

(AEM I)

24/9 2014

25 / 37

Testing for rst-order autocorrelation


Durbin-Watson test

Distribution is peculiar.
Moreover, it depends upon xt s.
In general, dw values close to 2 are ne, while dw values close to 0
imply positive autocorrelation.
The exact critical value is unknown, but upper and lower bounds can
be derived (see Table 4.8).
Thus (to test for positive autocorrelation):
I
I
I

dw is less than lower bound: reject.


dw is larger than upper bound: not reject
dw is in between: inconclusive.

The inconclusive region becomes smaller if T gets large.

(AEM I)

24/9 2014

26 / 37

Testing for rst-order autocorrelation


Durbin-Watson test

(AEM I)

24/9 2014

27 / 37

Testing for higher-order autocorrelation

Auxiliary regression in Breusch-Godfrey test:


et = 1 et

+ 2 et

+ ... + q et

+ xt0 + t

Null hypothesis:
H0 : 1 = 2 = ... = q = 0
Test statistic: (T
with q DF.

(AEM I)

q)

R 2 . Test follows Chi-squared distribution

24/9 2014

28 / 37

Illustration: the demand for ice cream

We have a time-series of 30 four-weekly observations 1951-1953.


Based on classic article Hildreth and Lu (1960).

See Figure 4.2 for three of these series.


EViews workle is available on Blackboard.

(AEM I)

24/9 2014

29 / 37

Illustration: the demand for ice cream

(AEM I)

24/9 2014

30 / 37

Illustration: the demand for ice cream

Command to run this regression: ls cons c price income temp

(AEM I)

24/9 2014

31 / 37

Illustration: the demand for ice cream

(AEM I)

24/9 2014

32 / 37

Illustration: the demand for ice cream


Regressing the OLS residuals upon their lag gives = 0.401 with an
R 2 of 0.149.
Run three commands in EViews:
I
I
I

ls cons c price income temp


genr e=resid
ls e e(-1)

This gives test statistics:

p
(T

1)

T = 2.19
R 2 = 4.32

Both reject the null of no autocorrelation. Possible solutions:


I
I
I

HAC standard errors.


EGLS.
Change model specication (see Table 4.11).
(AEM I)

24/9 2014

33 / 37

Illustration: the demand for ice cream

Command to run this regression: ls cons c price income temp


temp(-1)
Does this model suer from autocorrelation?
(AEM I)

24/9 2014

34 / 37

Illustration: incomplete dynamics


Consider the model
yt = 1 + 2 log xt + t
where
1 = 0
2 = 0.5
xt
t

= t
N (0, 0.01)

What happens if we use xt (instead of log xt ) to explain yt ?

(AEM I)

24/9 2014

35 / 37

Illustration: incomplete dynamics

We simulate 1000 observations from the model:


create incomplete_dynamics u 1 1000
genr x =1+@trend
genr eps = 0.1*@rnorm
genr y = 0 + 0.5*log(x)+eps
Next, we regress y on a constant and x. Then we make a test for
autocorrelation.

(AEM I)

24/9 2014

36 / 37

Summing up

We can test for autocorrelation using various tests.


In case our model suers from autocorrelation:
I
I

Importantly, the OLS estimator is still unbiased.


However, the OLS standard errors are incorrect.

Possible solutions:
I
I
I

Change model specication.


Use GLS/EGLS.
Use Newey-West standard errors.

(AEM I)

24/9 2014

37 / 37

Vous aimerez peut-être aussi