On Sun, 2 Feb 2014, Logan Kelly wrote:
This is a question that probably has not come up before (and may be a
new feature request) because I doubt that many researchers using gretl
need it much.
Is there an easy way for my MBA student to generate the descriptive
statistics including the standard error of the mean and confidence
intervals for the mean. There are a number of ways to do this already,
for example one could regress a series on a constant. But this is a bit
more difficult to explain to my MBA students who still do not understand
why they can't just use Excel.
Regressing x on a constant, as you suggest, would probably be the
"idiomatic" way for an econometrician to do this. Of course it's pretty
simple -- and might be of pedagogical use -- to write a script to do it
longhand:
<hansl>
scalar a = 0.05 # choose your alpha
scalar xbar = mean(x)
scalar n = sum(ok(x))
scalar se_xbar = sd(x)/sqrt(n)
scalar tscore = critical(t, n-1, a/2)
printf "Sample mean = %g, with standard error %g\n", xbar, se_xbar
printf "%g percent interval for mean: %g to %g\n", 100*(1-a),
xbar - tscore * se_xbar, xbar + tscore * se_xbar
</hansl>
Allin Cottrell