Using gret l for Principles of Econometrics, 4th Edition

Prediction in the Food Expenditure Model

Generating predicted values of food expenditure for a person with a given income is very simple in gretl. After estimating the model with least squares, you can use the genr or series to get predicted values for all the observations or use scalar to get a prediction at a specific point. In the example, a household having incomeo = $2000 of weekly income is predicted to spend approximately $287.61 on food. Recalling that income is measured in hundreds of dollars in the data, the gretl commands to compute this from the console are: [13] [14]

з scalar yhatO = $coeff(const) + $coeff(income)*20

This yields food-exp0 = 287.609. We could have used genr rather than scalar (or nothing at all before yhat0) and the correct result would be computed. Using scalar makes it clear to someone else reading the program that you intend this to compute a single number, not a series.

var(f) = a2 + + (incomeo — income)2 var(b2)

image090 Подпись: (4.1)

Obtaining the 95% confidence interval is slightly harder in that there are no internal commands in gretl that will do this. The information needed is readily available, however. The formula is:

In section 2.4 we estimated a2 = 8013.29 and var(b2) = 4.3818. The mean value of income is found by highlighting the variable income in the main gretl window and the selecting View>Summary Statistics from the pull-down menu. This yields income = 19.6047.1 The t38 5% critical value is 2.0244 and the computation2

8013.2941

var(f) = 8013.2941 +------ —---- + (20 — 19.6047)2 * 4.3818 = 8214.31 (4.2)

Then, the confidence interval is:

foodlexp0 ± tcse(f) = 287.6069 ± 2.0244%8214.31 = [104.132, 471.086] (4.3)

The complete script to produce the computed results in gretl is:

1 ols food_exp const income

2 scalar yhat0 = $coeff(const) + $coeff(income)*20

3 scalar f=8013.2941+(8013.2941/40)+4.3818*(20-19.6047)~2

4 scalar ub=yhat0+2.0244*sqrt(f)

5 scalar lb=yhat0-2.0244*sqrt(f)

At this point, you may be wondering if there is some way to use the internal functions of gretl to produce the same result? As we’ve seen, gretl saves many of the results we need internally and these can in turn be called into service in subsequent computations using their accessors.

For instance, the sum of squared errors from the least squares regression can be accessed using $ess. The degrees of freedom and number of observations are saved as $df and $nobs, respectively. Also, you can use an internal gretl function to compute income, mean(income), and the critical function discussed in the preceding chapter to get the desired critical value. Hence, the prediction interval can be automated and made more precise by using the following script. [15] [16]

1 ols food_exp const income

2 scalar yhat0=$coeff(const)+20*$coeff(income)

3 scalar sig2 = $ess/$df

4 scalar f = sig2 + sig2/$nobs + ((20-mean(income))"2)*($stderr(income)"2)

5 scalar lb = yhat0-critical(t,$df,0.025)*sqrt(f)

6 scalar ub = yhat0+critical(t,$df,0.025)*sqrt(f)

7 print yhat0 sig2 f lb ub

This produces

yhat0 = 287.60886

sig2 = 8013.2941

f = 8214.3110

lb = 104.13228

ub = 471.08545

which are the values we expect.

Добавить комментарий

Using gret l for Principles of Econometrics, 4th Edition

Simulation

In appendix 10F of POE4, the authors conduct a Monte Carlo experiment comparing the performance of OLS and TSLS. The basic simulation is based on the model y = x …

Hausman Test

The Hausman test probes the consistency of the random effects estimator. The null hypothesis is that these estimates are consistent-that is, that the requirement of orthogonality of the model’s errors …

Time-Varying Volatility and ARCH Models: Introduction to Financial Econometrics

In this chapter we’ll estimate several models in which the variance of the dependent variable changes over time. These are broadly referred to as ARCH (autoregressive conditional heteroskedas - ticity) …

Как с нами связаться:

Украина:
г.Александрия
тел./факс +38 05235  77193 Бухгалтерия

+38 050 457 13 30 — Рашид - продажи новинок
e-mail: msd@msd.com.ua
Схема проезда к производственному офису:
Схема проезда к МСД

Партнеры МСД

Контакты для заказов оборудования:

Внимание! На этом сайте большинство материалов - техническая литература в помощь предпринимателю. Так же большинство производственного оборудования сегодня не актуально. Уточнить можно по почте: Эл. почта: msd@msd.com.ua

+38 050 512 1194 Александр
- телефон для консультаций и заказов спец.оборудования, дробилок, уловителей, дражираторов, гереторных насосов и инженерных решений.