Using gret l for Principles of Econometrics, 4th Edition
Nonsample Information
In this section we’ll estimate a beer demand model. The data are in beer. gdt and are in level form. The model to be estimated is
ln(q) = ві + в2 ln(pb) + вз ln(pl) + в4 ln(pr) + вб ln(i) + e (6.6)
The first thing to do is to convert each of the variables into natural logs. Gretl has a built in function for this that is very slick. From the main window, highlight the variables you want to
transform with the cursor. Then go to Add>Logs of selected variables from the pull-down menu as shown in Figure 6.11. This can also be done is a script or from the console using the
Highlight the desired variables
using the mouse.
Figure 6.11: Use the pull-down menu to add the natural logs of each variable
command logs q pb pl pr i. The natural log of each of the variables is obtained and the result stored in a new variable with the prefix l_ (“el” underscore). An even easier way to add the logs is to highlight the variables and right-click the mouse. A pop-up menu appears and the Add logs option is available.
A no money illusion restriction can be parameterized in this model as + вз + в4 + вб = 0. This is easily estimated within gretl using the restrict dialog or a script as shown below.
1 open "@gretldirdatapoebeer. gdt"
2 logs q pb pl pr i
3 ols l_q const l_pb l_pl l_pr l_i —quiet
4 restrict
5 b2+b3+b4+b5=0
6 end restrict
b[l_pb] + b[l_pl] + b[l_pr] + b[l_i] = 0
Test statistic: F(1, 25) = 2.49693, with p-value = 0.126639 Restricted estimates:
Restricted estimates:
Standard error of the regression = 0.0616756 |
Figure 6.12: gretl output for the beer demand
The syntax for the restrictions is new. Instead of using b[2]+b[3]+b[4]+b[5]=0, a simpler form is used. This is undocumented in the gretl version I am using (1.9.5cvs) and I am uncertain of whether this will continue to work. It does for now and I’ve shown it here. Apparently gretl is able to correctly parse the variable number from the variable name without relying on the brackets. The output from the gretl script output window appears in Figure 6.12.