Interval Estimation

Estimating a confidence interval using the hip data is also easy to do in gretl. Since the true variance, a2, is not known, the t-distribution is used to compute the interval. The interval is

where tc is the desired critical value from the student-t distribution. In our case, N = 50 and the desired degrees of freedom for the t-distribution is N — 1 = 49. The gretl command critical(t,49,.025 can be used to return the 0.025 critical value from the t49 distribution shown in Figure C.1

The computation is

1 open "@gretldirdatapoehip. gdt"

2 scalar y_sd = sd(y)

3 scalar ybar_sd = y_sd/sqrt($nobs)

4 scalar lb = mean(y) – 2.01*ybar_sd

5 scalar ub = mean(y) + 2.01*ybar_sd

which indicates that the interval [16.64,17.67] works 95% of the time. Note these numbers differ slightly from those in your book because we used 2.01 as our critical value. Hill et al. carry their critical value out to more decimal places and hence the difference. You can use gretl’s internal functions to improve accuracy. Replace 2.01 with critical(t,$nobs-1,0.025) and see what happens!

1 scalar lb = mean(y) – critical(t,$nobs-1,0.025)*ybar_sd

2 scalar ub = mean(y) + critical(t,$nobs-1,0.025)*ybar_sd

3 printf "nThe 95% confidence interval is (%5.4f, %6.4f)n",lb, ub

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>