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

food. gdt

ID#< Variable name < Descriptive label

0 const

auto-generated constant

.... ........................................................................

ire per week

2 income

Display values Descriptive statistics Frequency distribution

^Edit attributed Edit values Copy to clipboard



Undated: Full range 1

Define new variable...

Figure 2.2: Highlight the desired variable and right-click to bring up the pull-down menu shown here. You can also use F2 or keyboard shortcut ‘CTRL+e’ to bring up the dialog.

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


Figure 2.3: Variable edit dialog box

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

The - d flag is given followed by a string in double quotes. It is used to set the descriptive label. The - n flag is used similarly to set the variable’s name in graphs. Notice that in the first and last uses of setinfo in the example that I have issued the continuation command () since these commands are too long to fit on a single line. If you issue the labels command, gretl will respond by printing the descriptions to the screen.

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

Using gret l for Principles of Econometrics, 4th Edition


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 512 11 94 — гл. инженер-менеджер (продажи всего оборудования)

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

Партнеры МСД

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

+38 096 992 9559 Инна (вайбер, вацап, телеграм)
Эл. почта:

За услуги или товары возможен прием платежей Онпай: Платежи ОнПай