/usr/share/gretl/scripts/ps6-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 | include criteria.gfn
# PS6.8 for Example 6.6
open data6-4
logs WAGE
# generate square of education
square EDUC
# estimate linear model
ols WAGE 0 sq_EDUC EXPER
# estimate log-linear model
ols l_WAGE 0 sq_EDUC EXPER
# save fitted log values
genr lwhat = l_WAGE - $uhat
# save ess for bias correction
genr sgmasq=$ess/$df
# generate adjusted fitted value
genr what = exp(lwhat+(sgmasq/2))
# compute error in new fitted value
genr error = WAGE -what
# compute new ess
genr ess = sum(error*error)
# learn about the "criteria" function
help criteria
# compute selection criteria
criteria(ess, 49, 3)
# compute correlation between observed WAGES and adjusted predictions
corr WAGE what
genr c1 = corr(WAGE,what)
genr rsq = c1*c1
print rsq
|