Using gret l for Principles of Econometrics, 4th Edition
Gretl Basics
There are several different ways to work in gretl. Until you learn to use gretl’s rather simple and intuitive language syntax, the easiest way to use the program is through its built-in graphical user interface (GUI). The graphical interface should be familiar to most of you. Basically, you use your computer’s mouse to open dialog boxes. Fill in the desired options and execute the commands by clicking on the OK button. Gretl is using your input from the dialogs, delivered by mouse clicks and a few keystrokes, to generate computer code that is executed in the background.
Of course, you can generate your own programs directly, either by using a command line version or by using the GUI via the gretl console or through scripts.
Gretl’s command line version is a separate executable that gives you access to gretl commands directly from your computer’s command prompt. This bypasses the GUI altogether.
To open the command line version of gretl in Windows, open a command window and type gretlcli. In Windows 7 choose Start>Run to open the dialog shown in figure 1.1. In the box, use
Figure 1.1: Opening the command line interface version of gretl using Start>Run |
Browse button to locate the directory in which gretl is installed. On my machine it is installed on the "C:Program Files (x86)gretlgretlcli. exe" drive. Click OK and the command line version shown in figure 1.2 opens. There are a couple of messages that certain entries could not be found in the Windows registry, which in this case means that these programs are not installed or registered on my particular machine. If you receive these, don’t be alarmed. Gretl will still operate. The question mark (?) is the command prompt. To open one of the data sets that installs with gretl, type open engel at the prompt. The gretl data set engel. gdt opens and some
mins.
If you are in fact using the Microsoft Windows operating system, then you probably won’t be using gretl from the command line very often anyway. This version of the program is probably the most useful for Linux users wishing to run gretl from a terminal window. If you are using a machine that is resource constrained, the command line interface is one way to free resources that would otherwise be used to operate the graphical interface. We won’t be using the command line version in this manual.
A better way to execute single gretl commands is through the gretl console. In normal practice, the console is a lot easier to use than the gretlcli. exe. It offers some editing features and immediate access to other ways of using gretl that aren’t available in the straight command line version of the program. The console and its use is discussed in section 1.3.1.
If you want to execute a series of commands, you do this using scripts. One of the great things about gretl is that it accumulates commands executed singly from the console into a command log that can be run in its entirety at another time. This topic can be found in section 1.3.2. So, if you have completed an analysis that involves many sequential steps, the steps can be saved to a script file which can later be opened and run in one step to get the result.
You can use the script environment to conduct Monte Carlo studies in econometrics. Monte Carlo studies use computer simulation (sometimes referred to as experiments) to study the properties of a particular technique. This is especially useful when the mathematical properties of your technique are particularly difficult to ascertain. In the exercises below, you will learn a little about doing these kinds of experiments in econometrics. Also, you can consult a separate paper of mine Adkins (20116) which can be found at http://www. learneconometrics. com/pdf/MCgretl/ index. htm.
In Figure 1.3 you will find the main window in gretl.
Across the top of the window you find the menu bar. From here you import and manipulate data, analyze data, and manage output. At the bottom of the window is the gretl toolbar. This contains a number of useful utilities that can be launched from within gretl. Among other things, you can get to the gretl web site from here, open the pdf version of the manual, or open the MS Windows calculator (very handy!). More will be said about these functions later.