/usr/share/gretl/scripts/ps6-6.inp is in gretl-common 2017d-3build1.
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 | # PS6.6 for Application Section 6.7
open data3-3
ols PATENTS 0 R_D
# generate lagged variables
genr R_D1 = R_D(-1)
genr R_D2 = R_D(-2)
genr R_D3 = R_D(-3)
genr R_D4 = R_D(-4)
# print them to see that missing observations are denoted by -999
print R_D R_D1 R_D2 R_D3 R_D4
# generate square terms
square R_D R_D1 R_D2 R_D3 R_D4
# reset sample range because lagged variables are undefined for the
# period 1960-63
smpl 1964 1993
# estimate the most general urestricted model
ols PATENTS const R_D R_D1 R_D2 R_D3 R_D4 sq_R_D \
sq_R_D1 sq_R_D2 sq_R_D3 sq_R_D4
# omit variables with p-values above 0.9
omit 3 5 11
# omit variables with p-values above 0.5
omit 7 9 10
# omit one at a time
omit 8
omit 4
# compute predicted values
genr pred = PATENTS - $uhat
# save residuals
genr error = $uhat
# compute absolute % error
genr abspcerr = 100*abs(error)/PATENTS
# print values as in a table with the -o flag
print -o R_D PATENTS pred error abspcerr
|