This introduction is mostly angled towards the graphical client program; please see Chapter 10 and Chapter 12 below for details on the command-line program, gretlcli.
You can supply the name of a data file to open as an argument to gretl, but for the moment let's not do that: just fire up the program.[1] You should see a main window (which will hold information on the data set but which is at first blank) and various menus, some of them disabled at first.
What can you do at this point? You can browse the supplied data files (or databases), open a data file, create a new data file, read the help items, or open a command script. For now let's browse the supplied data files. Under the File menu choose "Open data, sample file, Ramanathan…". A second window should open, presenting a list of data files supplied with the package (see Figure 2-1). The numbering of the files corresponds to the chapter organization of Ramanathan (2002), which contains discussion of the analysis of these data. The data will be useful for practice purposes even without the text.
If you select a row in this window and click on "Info" this pops open the the "header file" for the data set in question, which tells you something about the source and definition of the variables. If you find a file that is of interest, you may open it by clicking on "Open", or just double-clicking on the file name. For the moment let's open data3-6.
Tip: In gretl windows containing lists, double-clicking on a line launches a default action for the associated list entry: e.g. displaying the values of a data series, opening a file.
This file contains data pertaining to a classic econometric "chestnut", the consumption function. The data window should now display the name of the current data file, the overall data range and sample range, and the names of the variables along with brief descriptive tags — see Figure 2-2.
OK, what can we do now? Hopefully the various menu options should be fairly self explanatory. For now we'll dip into the Model menu; a brief tour of all the main window menus is given in Chapter 3 below.
gretl's Model menu offers numerous various econometric estimation routines. The simplest and most standard is Ordinary Least Squares (OLS).
Selecting OLS pops up a dialog box calling for a model specification. This takes the form of a list of variable names or numbers, separated by spaces. The first name or number represents the dependent variable, the remainder the independent variables. It is usual to include a constant (ID number 0) among the independent variables (otherwise you are forcing the intercept to equal zero).
Tip: You can put a variable's ID number into the dialog box by clicking on that variable's row in the main window.
Thus, continuing the example of data3-6, the entry 1 0 2 (or equivalently Ct 0 Yt) specifies a regression of consumption (dependent) on income and a constant.
You can specify a lagged value of an existing variable without explicitly adding this to the data set first. Thus a variant on the above estimation command which includes the first lag of income on the right-hand side would be 1 0 2 Yt(-1) The lag is selected using a negative integer enclosed in parentheses. Note that in this context the name, not the number, of the variable in question must be used.
Once you've specified a model, a window displaying the regression output will appear. The output is reasonably comprehensive and in a standard format (Figure 2-3).
The output window contains menus that allow you to inspect or graph the residuals and fitted values, and to run various diagnostic tests on the model.
There is also an option to reprint the regression output in LaTeX format. This is not fully implemented yet, but works for OLS models. You can print the results in a tabular format (similar to what's in the output window, but properly typeset) or as an equation, across the page. For each of these options you can choose to preview the typeset product, or save the output to file for incorporation in a LaTeX document. Previewing requires that you have a functioning TeX system on your computer.
If you want to import gretl output into an editor or word processor there are two main options. You can simply copy and paste from an output window (using its
menu) to the target program, or you can save the output to a file then import the file into the target program. When you finish a gretl session you are given the option of saving all the output from the session to a single file.Tip: When inserting gretl output into a word processor, select a monospaced or typewriter-style font (e.g. Courier) to preserve the output's tabular formatting. Select a small font (10-point Courier should do) to prevent the output lines from being broken in the wrong place.
[1] | For convenience I will refer to the graphical client program simply as gretl in this manual. Note, however, that the specific name of the program differs according to the computer platform. On unix-like systems it is called gretl_x11 while on MS Windows it is gretlw32.exe. On unix-like systems a wrapper script named gretl is also installed — see also Chapter 9. |