# Replicate Example 18.6 in Greene, 4ed 
open greene18_2.gdt
genr yt = log(Y/P)
genr d_yt = diff(yt)
# Do unit root test manually first
smpl 1950:3
ols d_yt const yt(-1)
ols d_yt const time yt(-1) d_yt(-1)
genr r2u = $rsq
genr dfu = $df
genr time
ols d_yt const d_yt(-1)
genr r2r = $rsq
genr Fsamp = ((r2u - r2r)/2) / ((1.0 - r2u)/dfu)
print Fsamp
# Automated ADF test
adf 1 yt
# Periodograms
smpl 1950:2
pergm yt
pergm d_yt
