/usr/share/gretl/scripts/ps3-1.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 34 35 36 37 38 39 40 41 | # PS3.1, for various examples in Chapter 3
open data3-1
textplot 1 2
# learn about the ols command
help ols
# estimate model; --vcv is to get covariance
ols 1 0 2 --vcv
# gretl saves fitted values under the name $yhat. Copy this to phat1
genr phat1 = $yhat
# print values
print phat1
# gretl saves residuals under the name $uhat. Copy this to ut
genr ut = $uhat
# another way to get fitted value is to subtract the error from the
# actual value of the dependent variable
genr yh2 = price - ut
# print values
print yh2
# retrieve number of obsservations
genr n = $nobs
# retrieve ESS - Section 3.4
genr ESS = $ess
# compute standard deviation for price
genr sdy = sd(price)
# compute TSS - Example 3.4
genr TSS = (n-1)*sdy*sdy
# compute RSS
genr RSS = TSS - ESS
# retrieve R-square
genr RSQ = $rsq
# print values
print TSS ESS RSS RSQ
# F-statistic in Example 3.6
genr Fc = RSS*(n-2)/ESS
# print F-statistic
print Fc
# graph price and phat1 against sqft - connect x to get approximate line
textplot price phat1 sqft
# Reproduce predicted averages in Table 3.1 using only 3 decimals
genr phat3 = 52.351+(0.139*sqft)
print -o price phat3
|