Appendix D. Advanced econometric analysis with free software

As mentioned in the main text, gretl offers a reasonably full selection of least-squares based estimators, plus a few additional estimators such as (binomial) logit and probit and Least Absolute Deviations. Advanced users may, however, find gretl's menu of statistical routines restrictive.

No doubt some advanced users will prefer to write their own statistical code in a fundamental computer language such as C, C++ or Fortran. Another option is to use a relatively high-level language that offers easy matrix manipulation and that already has numerous statistical routines built in, or available as add-on packages. If the latter option sounds attractive, and you are interested in using free, open source software, I would recommend taking a look at either GNU R (r-project.org) or GNU Octave (www.octave.org). These programs are very close to the commercial programs S and Matlab respectively.

Also as mentioned above, gretl offers the facility of exporting data in the formats of both Octave and R. In the case of Octave, the gretl data set is saved as a single matrix, X. You can pull the X matrix apart if you wish, once the data are loaded in Octave; see the Octave manual for details. As for R, the exported data file preserves any time series structure that is apparent to gretl. The series are saved as individual structures. The data should be brought into R using the source() command.

Of these two programs, R is perhaps more likely to be of immediate interest to econometricians since it offers more in the way of statistical routines (e.g. generalized linear models, maximum likelihood estimation, time series methods). I have therefore supplied gretl with a convenience function for moving data quickly into R. Under gretl's Session menu, you will find the entry "Start GNU R". This writes out an R version of the current gretl data set (Rdata.tmp, in the user's gretl directory), and sources it into a new R session. A few details on this follow.

First, the data are brought into R by writing a temporary version of .Rprofile in the current working directory. (If such a file exists it is referenced by R at startup.) In case you already have a personal .Rprofile in place, the original file is temporarily moved to .Rprofile.gretltmp, and on exit from gretl it is restored. (If anyone can suggest a cleaner way of doing this I'd be happy to hear of it.)

Second, the particular way R is invoked depends on the internal gretl variable Rcommand, whose value may be set under the File, Preferences menu. The default command is RGui.exe under MS Windows. Under X it is either R --gui=gnome if an installation of the Gnome desktop (gnome.org) was detected at compile time, or xterm -e R if Gnome was not found. Please note that at most three space-separated elements in this command string will be processed; any extra elements are ignored.