/usr/share/gretl/scripts/ps10-8.inp is in gretl-common 2016a-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | # PS10.8, for the Application section 10.9
open data10-4
genr ml = um * 100/gnpdef
# convert to real terms
genr g = ug * 100/gnpdef
# generate log variables
logs ml g
# generate first difference of logs
genr milit = ldiff(ml)
genr govt = ldiff(g)
# generate error correction term
genr longdef = l_g(-1) - l_ml(-1)
# create interaction terms
genr lpres = longdef * pres
genr lelect = longdef * elect
genr lreagan = longdef * reagan
genr lopp = longdef * opp
genr lhdem = longdef * hdem
genr lsdem = longdef * sdem
genr lww2 = longdef * ww2
genr lkwar = longdef * kwar
genr lvwar = longdef * vwar
genr lkrus = longdef * krus
genr lgorb = longdef * gorb
genr lsalt = longdef * salt
list
# suppress the first observation
smpl 1941 ;
# estimate the basic error correction model
ols milit const govt longdef
# estimate the model in equation (10.27)
ols milit const govt longdef lpres lelect lreagan lopp lhdem lsdem lww2 \
lkwar lvwar lkrus lgorb lsalt
# LM test for first order autocorrelation
genr ut = $uhat
genr ut1 = ut(-1)
smpl 1942 ;
ols ut const govt longdef lpres lelect lreagan lopp lhdem lsdem lww2 \
lkwar lvwar lkrus lgorb lsalt ut1
genr LM = $trsq
pvalue X 1 LM
smpl 1941 ;
# mixed Hilu-Corc estimation of the general model
ar1 milit const govt longdef lpres lelect lreagan lopp lhdem lsdem lww2 \
lkwar lvwar lkrus lgorb lsalt --hilu
# recursively omit variable with the highest p-value
omit lhdem
omit lelect
omit lsalt
omit lreagan
omit lgorb
omit lpres
omit lopp
# re-try the above using the --auto option
ar1 milit const govt longdef lpres lelect lreagan lopp lhdem lsdem lww2 \
lkwar lvwar lkrus lgorb lsalt --hilu
omit --auto
|