Using gret l for Principles of Econometrics, 4th Edition
Retrieve the Data
The first step is to load the food expenditure and income data into gretl. The data file is included in your gretl sample files-provided that you have installed the Principles of Econometrics data supplement that is available from our website. See section 1.1.1 for details.
Figure 2.1: The main gretl window. The food expenditure data is loaded from food. gdt using File>Open data>sample file and choosing the food dataset from the sample files that accompany POE4. |
Load the data from the data file food. gdt. Recall, this is accomplished by the commands File>Open data>Sample file from the menu bar.[4] Choose food from the list. When you bring the file containing the data into gretl your window will look like the one in Figure 2.1. Notice that in the Descriptive label column contains some information about the variables in the program’s memory. For some of the datasets included with this book, it may be blank. These descriptions, when they exist, are used by the graphing program to label your output and to help you keep track of variables that are available for use. Before you graph your output or generate results for a report or paper you may want to label your variables to make the output easier to understand. This can be accomplished by editing the attributes of the variables.
File Tools Data View Add Sample Variable Model Help
|
To do this, first highlight the variable whose attributes you want to edit, right-click and the menu shown in (see Figure 2.2) appears. Select Edit attributes to open a dialog box (Figure 2.3) where you can change the variable’s name, assign variable descriptions and display names. Describe and label the variable food_exp as ‘Food Expenditure’ and income as ‘Weekly Income ($100).’ The dialog can also be opened using F2 from the main gretl window or using the keyboard
shortcut, ‘E.’ Finally, the setinfo command can be used to set the description and the label used
Figure 2.4: Use the dialog to plot of the food expenditure against Weekly Income in graphs. |
In the following example a script is generated that opens the food. gdt dataset, and adds variable descriptions, and assigns a label to be used in subsequent graphs.
open "@gretldirdatapoefood. gdt"
setinfo food_exp - d "household food expenditure per week"
-n "Food Expenditure"
setinfo income - d "weekly household income" - n "Weekly Income" labels