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


an independent variable by placing the variable const in the list by default. To include x as an independent variable, highlight it with the cursor and click the ‘Add->’ button.

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)

Подпись: T40 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

Подпись: CoefficientПодпись: const 83.4160 income 10.2096Std. Error t-ratio p-value

43.4102 1.9216 0.0622

2.09326 4.8774 0.0000

Mean dependent var


S. D. dependent var


Sum squared resid


S. E. of regression




Adjusted R2


F(1, 38)






Akaike criterion


Schwarz criterion




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

One (1) is the ID number for food_exp and two (2) is the ID number of income. The constant has ID zero (0). If you tend to use long and descriptive variable names (recommended, by the way), using the ID number can save you a lot of typing (and some mistakes).

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>