/usr/share/gretl/scripts/ps10-4.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 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.4, for Application Section 10.5
open data6-3
genr C1 = Cons(-1)
genr DI1 = DI(-1)
# Generate first difference of disposable income
genr DiffI = diff(DI)
# Model A - Static model with OLS estimation
ols Cons 0 DI
# Model A - Static model with AR(1) error & CORC estimation
ar1 Cons 0 DI
# Model A - Static model with AR(1) error & mixed HILU-CORC
# estimation. Note that CORC misses the global minimum here also.
ar1 Cons 0 DI --hilu
# Retrieve sigma tilde square for Likelihood Ratio test
genr sgmasqr = $ess/$T
# Suppress the first observation
smpl 1949 1989
# Model B - General dynamic model with no restrictions
ols Cons 0 C1 DI DI1
# Save uhat for LM test for AR(1) and generate uhat(t-1)
genr ut = $uhat
genr ut1=ut(-1)
# Retrieve error sum of squares for Wald test
genr essu = $ess
# Retrieve sigma hat square for Likelihood Ratio test
genr sgmasqu = $ess/$T
# Retrieve d.f. for unrestricted Model B
genr dfu = $df
# compute -2log likelihood for LR test
genr LR=-$T*ln(sgmasqu/sgmasqr)
pvalue X 1 LR
# Reset sample range for LM test for AR(1)
smpl 1950 1989
# Auxiliary regression for the LM test
ols ut 0 ut1 C1 DI DI1
# Compute trsquare statistic and corresponding p-value
genr LM1 = $trsq
pvalue X 1 LM1
# Model C - Restricted model with coeff. for DI and DI1 adding to zero
smpl 1949 1989
ols Cons 0 C1 DiffI
# Save uhat for LM test for AR(1) and generate uhat(t-1)
genr utt = $uhat
genr utt1=utt(-1)
# Retrieve error sum of squares for WALD test
genr essr = $ess
# Reset sample range for LM test for AR(1)
smpl 1950 1989
# Auxiliary regression for the LM test
ols utt 0 utt1 C1 DiffI
# Compute trsquare and p-value for LM test
genr LM2 = $trsq
pvalue X 1 LM2
# Compute WALD F-statistic
genr WALD = dfu*(essr-essu)/essu
# Compute p-value for F-distribution
pvalue F 1 dfu WALD
|