Using gret l for Principles of Econometrics, 4th Edition
Estimate the Food Expenditure Relationship
Now you are ready to use gretl to estimate the parameters of the food expenditure equation.
food-expt = ві + в2incomet + et t = 1, 2,..., T (2.2)
From the menu bar, select Model>Ordinary Least Squares from the pull-down menu (see Figure 2.6) to open the dialog box shown in Figure 2.7. From this dialog you’ll need to tell gretl which variable to use as the dependent variable and which is the independent variable. Notice that by default, gretl assumes that you want to estimate an intercept (в1) and includes a constant as
At the question mark in the console simply type
ols y const x
to estimate your regression function. The syntax is very simple, ols tells gretl that you want to estimate a linear function using ordinary least squares. The first variable listed will be your dependent variable and any that follow, the independent variables. These names must match the ones used in your data set. Since ours in the food expenditure example are named, y and x, respectively, these are the names used here. Don’t forget to estimate an intercept by adding a constant (const) to the list of regressors. Also, don’t forget that gretl is case sensitive so that x and X are different entities.
This yields window shown in Figure 2.9 below. The results are summarized in Table 2.1.
An equivalent way to present results, especially in very small models like the simple linear regression, is to use equation form. In this format, the gretl results are:
food_exp = 83.4160 + 10.2096 income
(43.410) (2.0933)
40 R2 = 0.3688 F(1, 38) = 23.789 <r = 89.517 (standard errors in parentheses)
Finally, notice in the main gretl window (Figure 1.3) that the first column has a heading called
Table 2.1: OLS estimates using the 40 observations 1-40.
OLS, using observations 1-40 Dependent variable: food_exp
Std. Error t-ratio p-value
43.4102 1.9216 0.0622
2.09326 4.8774 0.0000
Mean dependent var |
283.5735 |
S. D. dependent var |
112.6752 |
Sum squared resid |
304505.2 |
S. E. of regression |
89.51700 |
R2 |
0.385002 |
Adjusted R2 |
0.368818 |
F(1, 38) |
23.78884 |
P-value(F) |
0.000019 |
Log-likelihood |
-235.5088 |
Akaike criterion |
475.0176 |
Schwarz criterion |
478.3954 |
Hannan-Quinn |
476.2389 |
ID #. An ID # is assigned to each variable in memory and you can use the ID # instead of its variable name in your programs. For instance, the following two lines yield identical results:
1 ols food_exp const income
2 ols 102