[gretl main page]
If you're using gretl in a teaching context you may be interested in adding a collection of data files or scripts that relate specifically to your course, in such a way that students can browse and access them easily. This is supported in gretl 1.2.1 and higher.
You can arrange matters so that a custom data file collection appears among the options when a gretl user selects "File, Open data, sample file", or clicks the folder icon on the gretl toolbar.
Similarly, you can make a custom collection of scripts appear when the user selects the "File, Open command file, practice file" menu item.
When one of the menu items mentioned above is accessed, gretl searches for valid file collections in these places: the "system" gretl data directory, the system gretl script directory, the gretl user directory, and all first-level subdirectories of these. For reference, typical values for these directories are:
|location||Linux default||Windows default|
system data dir
system script dir
Any valid collections will be added to the selection windows. So what constitutes a valid file collection? This comprises either a set of data files in gretl's XML format (with the .gdt suffix) or a set of script files containing gretl commands (with .inp suffix), in each case accompanied by a "master file" or catalog. The current gretl distribution contains several example catalog files, for instance the file descriptions in the "misc" sub-directory of the gretl data directory and ps_descriptions in the "misc" sub-directory of the gretl scripts directory.
I recommend that if you are adding your own collection, data catalogs should be named "descriptions" and script catalogs should be be named "ps_descriptions". In each case these files should be placed (along with the associated data or script files) in their own specific sub-directories (e.g. /usr/share/gretl/data/mydata or c:\userdata\gretl\data\mydata).
The syntax of the (plain text) description files is straightforward. here, for example, are the first few lines of gretl's "misc" data catalog:
# Gretl: various illustrative datafiles "arma","artificial data for ARMA script example" "ects_nls","Nonlinear least squares example" "hamilton","Prices and exchange rate, U.S. and Italy"
The first line, which must start with a hash mark, contains a short name, here "Gretl", which will appear as the label for this collection's tab in the data browser window, followed by a colon, followed by an optional short description of the collection.
Subsequent lines contain two elements, separated by a comma and wrapped in double quotation marks. The first is a datafile name (leave off the .gdt suffix here) and the second is a short description of the content of that datafile. There should be one such line for each datafile in the collection.
A script catalog file looks very similar, except that there are three fields in the file lines: a filename (without its .inp suffix), a brief description of the econometric point illustrated in the script, and a brief indication of the nature of the data used. Again, here are the first few lines of the gretl "misc" script catalog:
# Gretl: various sample scripts "arma.inp","ARMA modeling","artificial data" "ects_nls","Nonlinear least squares (Davidson)","artificial data" "leverage","Influential observations","artificial data" "longley","Multicollinearity","US employment"
If you want to make your own data collection available in gretl, these are the steps:
Assemble the data, in whatever format is convenient.
Convert the data to gretl format and save as .gdt files. It is probably easiest to convert the data by importing them into gretl from plain text, CSV, or a spreadsheet format (MS Excel or Gnumeric) then saving as gdt. You may wish to add descriptions of the individual variables (the "Variable, Edit attributes" menu item), and add information on the source of the data (the "Data, Edit info" menu item).
Write a "descriptions" file for the collection using a text editor.
Put the datafiles plus the descriptions file in a subdirectory of the gretl data directory (or user directory).
If you assemble such a collection, and the data are not proprietary, I would encourage you to submit the collection for packaging as a gretl "optional extra".
Allin Cottrell <email@example.com>