/usr/share/gretl/scripts/ps2-3.inp is in gretl-common 1.9.6-1build1.
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 | # PS2.3 -- on covariance and corr. coeff. - Section 2.5
open data2-2
genr x = colgpa
genr y = hsgpa
genr n = $nobs
# mean of colgpa
genr xbar = mean(x)
# s.d. of colgpa
genr sx = sd(x)
# mean of hsgpa
genr ybar = mean(y)
# s.d. of hsgpa
genr sy = sd(y)
# cross product of deviation from mean
genr sxy = (x-xbar)*(y-ybar)
# compute covariance
genr covxy = sum(sxy)/(n-1)
# compute correlation coefficient
genr corxy = covxy/(sx*sy)
# reset sample range
smpl 1 1
# print values
print xbar sx ybar sy covxy corxy
# reset sample range
smpl 1 427
# same with the corr command
corr x y
# summary statistics
summary x y
|