/usr/share/gretl/scripts/ps8-6.inp is in gretl-common 1.9.14-2.
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 | # PS8.6, to reproduce Example 8.7
open data8-2
ols exptrav 0 income
# save absolute value of errors as absuhat1
genr absuhat1=abs($uhat)
# auxiliary regression for the Glejer test
ols absuhat1 0 pop
# compute test statistic and p-value
genr LM1=$nrsq
pvalue X 1 LM1
# since heteroscedasticity is detected, divide model by pop and
# estimate by OLS
genr pcexp=exptrav/pop
genr pcincm=income/pop
genr invpop=1/pop
# estimate transformed model -- note that there is no constant term
ols pcexp invpop pcincm
# test for heteroscedasticity on the transformed model
genr absuhat2=abs($uhat)
ols absuhat2 0 pop
genr LM2=$nrsq
# the high p-value suggests that we cannot reject homoscedasticity and
# hence OLS is acceptable
pvalue X 1 LM2
# wls command is a short cut -- coeff., tstat, ess, should be the same
# but Rsquared will be different
genr w = invpop^2
wls w exptrav 0 income
|