# Reproduce some of the time-series material in Stock and Watson,
# "Introduction to Econometrics", 1e, chapter 12
open sw_ch12.gdt

# S & W use White's standard errors in this chapter,
# not HAC.
set force_hc on
set hc_version 1

# generate inflation rate
genr infl = 400 * log(PUNEW/PUNEW(-1))
diff infl 
lags d_infl LHUR
smpl 1962:1 1999:4

# equation 12.7
ols d_infl 0 d_infl_1 --robust

# equation 12.13
ols d_infl 0 d_infl(-1 to -4) --robust

# F-test following 12.13  
omit d_infl_2 d_infl_3 d_infl_4 --quiet

# equation 12.16
ols d_infl 0 d_infl(-1 to -4) LHUR_1 --robust

# equation 12.17
ols d_infl 0 d_infl(-1 to -4) LHUR(-1 to -4) --robust

# ADF regression, equation 12.34
genr infl_1 = infl(-1)
ols d_infl 0 infl_1 d_infl(-1 to -4)
genr adft = $coeff(infl_1) / $stderr(infl_1)
print adft
