B632 07lect10b
B632 07lect10b
B632 07lect10b
Analysis
Tests for Autocorrelation
Examples
Durbin-Watson Tests
Modeling Autoregressive Relationships
Event Inertia
Spatial ordering
e
)
i i 1 , fornandK 1d.f.
d
2
e
i
Positive
Zone of
No Autocorrelation
Zone of
Negative
autocorrelation
indecision
indecision
autocorrelation
|_______________|__________________|_____________|_____________|__________________|
___________________|
0
d-lower
d-upper
2
4-d-upper
4-d-lower
Number of obs
F( 2,
325)
Prob > F
R-squared
Adj R-squared
Root MSE
=
=
=
=
=
=
328
52.63
0.0000
0.2447
0.2400
.058
-----------------------------------------------------------------------------price |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+---------------------------------------------------------------ice |
.060075
.006827
8.80
0.000
.0466443
.0735056
quantity | -2.27e-06
2.91e-07
-7.79
0.000
-2.84e-06
-1.69e-06
_cons |
.2783773
.0077177
36.07
0.000
.2631944
.2935602
------------------------------------------------------------------------------
Runs continued
Next, order the signs of the residuals
against time (or spatial ordering in the
case of cross-sectional data) and see if
there are excessive runs of positives or
negatives. Alternatively, you can graph
the residuals and look for the same trends.
- 0 .5 0
A u to c o r re la tio n s o f p r ic e
0 .0 0
0 .5 0
1 .0 0
10
20
Lag
30
40
Yt i b0 b1Yt i 1 b2 X 2 ...
In this case, we use the Durbin alternative test
For AR models, need to explicitly estimate the
correlation between Yi and Yi-1 as a model parameter
Techniques:
AR1 models (closest to regression; 1st order only)
ARIMA (any order)
Differencing
Differencing is simply the act of subtracting the previous
observation value from the current observation.
To do this in Stata, again use the generate command with a capital
D (instead of the L for lags)
D1.x xt xt 1
Prais-winsten regression
Source |
SS
df
MS
-------------+-----------------------------Model | .012722308
2 .006361154
Residual | .134323736
325 .000413304
-------------+-----------------------------Total | .147046044
327 .000449682
-----------------------------------------------------------------------------price |
Coef.
Std. Err.
t
P>|t|
[95% Conf. Interval]
-------------+---------------------------------------------------------------ice |
.0098603
.0059994
1.64
0.101
-.0019422
.0216629
quantity | -1.11e-07
1.70e-07
-0.66
0.512
-4.45e-07
2.22e-07
_cons |
.2517135
.0195727
12.86
0.000
.2132082
.2902188
-------------+---------------------------------------------------------------rho |
.9436986
-----------------------------------------------------------------------------Durbin-Watson statistic (original)
0.210907
Durbin-Watson statistic (transformed) 1.977062
Number of obs
F( 2,
325)
Prob > F
R-squared
Adj R-squared
Root MSE
=
=
=
=
=
=
328
15.39
0.0000
0.0865
0.0809
.02033
ARIMA
The ARIMA model allows us to test the
hypothesis of autocorrelation and remove
it from the data.
This is an iterative process akin to the
purging we did when creating the ystar
variable.
The model
ARIMA regression
Sample:
1 to 328
Log likelihood =
811.6018
Number of obs
Wald chi2(1)
Prob > chi2
=
=
=
328
3804.80
0.0000
-----------------------------------------------------------------------------|
OPG
price |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------price
|
_cons |
.2558135
.0207937
12.30
0.000
.2150587
.2965683
-------------+---------------------------------------------------------------ARMA
|
ar |
L1. |
.9567067
.01551
61.68
0.000
.9263076
.9871058
-------------+---------------------------------------------------------------/sigma |
.0203009
.000342
59.35
0.000
.0196305
.0209713
------------------------------------------------------------------------------
Estimate of rho
Significant lag
-0 .2 0
A u to c o rre la tio n s o f e
-0 .1 0
0 .0 0
0 .1 0
0 .2 0
10
20
Lag
30
40
1 to 328
Log likelihood =
812.9607
Number of obs
Wald chi2(3)
Prob > chi2
=
=
=
328
3569.57
0.0000
-----------------------------------------------------------------------------|
OPG
price |
Coef.
Std. Err.
z
P>|z|
[95% Conf. Interval]
-------------+---------------------------------------------------------------price
|
ice |
.0095013
.0064945
1.46
0.143
-.0032276
.0222303
quantity | -1.04e-07
1.22e-07
-0.85
0.393
-3.43e-07
1.35e-07
_cons |
.2531552
.0220777
11.47
0.000
.2098838
.2964267
-------------+---------------------------------------------------------------ARMA
|
ar |
L1. |
.9542692
.01628
58.62
0.000
.9223611
.9861773
-------------+---------------------------------------------------------------/sigma |
.0202185
.0003471
58.25
0.000
.0195382
.0208988
------------------------------------------------------------------------------
Final thoughts
Each correction has a best application.
If we wanted to evaluate a mean shift (dummy
variable only model), calculating rho will not
be a good choice. Then we would want to
use the lagged dependent variable
Also, where we want to test the effect of
inertia, it is probably better to use the lag
Next Time:
Review for Exam
Plenary Session
Exam Posting
Available after class Wednesday