Subido por Bárbara

Spurious regression

Anuncio
Spurious regression in Stata
1.- Generate two independent unit roots with drift
To do this:
1.- set obs 500
2.- generate t=_n
3.- tsset t
4.- gen e1=rnormal()
5.- gen e2=rnormal()
6.- gen y1=e
7.- gen y2=e
8.- replace y1=0.05+L.y1+e1 if t>1
9.- replace y2=0.02+L.y2+e2 if t>1
Plot the time series:
graph twoway tsline y1 y2, lpattern(solid dash)
regress y1 on y2 to see if they are dependent
regress y2 y1, r
predict err, resid
corrgram err, lags(10)
dfuller err, lags(4)
regress first difference of y1 on first difference of y2
graph twoway tsline D.y1 D.y2, lpattern(solid dash)
regress D.y2 D.y1, r
predict err2, resid
corrgram err2, lags(10)
dfuller err2, lags(4)
Note.- Repeat the exercise for two unit roots without drift
Descargar