# Options, arguments and path-searching

## gretl

`gretl` (under MS Windows, `gretlw32.exe`) On Linux, a wrapper script named `gretl` is installed. This script checks whether the `DISPLAY` environment variable is set; if so, it launches the GUI program, `gretl_x11`, and if not it launches the command-line program, `gretlcli`.

— Opens the program and waits for user input.

`gretl` datafile

— Starts the program with the specified datafile in its workspace. The data file may be in native gretl format, CSV format, or BOX1 format (see above). The program will try to detect the format of the file and treat it appropriately. See also below for path-searching behavior.

`gretl --help` (or `gretl -h`)

— Print a brief summary of usage and exit.

`gretl --version` (or `gretl -v`)

— Print version identification for the program and exit.

`gretl --english` (or `gretl -e`)

— Force use of English instead of translation.

`gretl --run` scriptfile (or `gretl -r` scriptfile)

— Start the program and open a window displaying the specified script file, ready to run. See below for path-searching behavior.

`gretl --db` database (or `gretl -d` database)

— Start the program and open a window displaying the specified database. If the database files (the `.bin` file and its accompanying `.idx` file — see ) are not in the default system database directory, you must specify the full path.

`gretl --dump` (or `gretl -c`)

— Dump the program's configuration information to a plain text file (the name of the file is printed on standard output). May be useful for trouble-shooting.

Various things in gretl are configurable under the File, Preferences menu.

- The base directory for gretl's shared files.

- The user's base directory for gretl-related files.

- The command to launch gnuplot.

- The command to launch GNU R (see ).

- The command with which to view &tex; DVI files.

- The directory in which to start looking for native gretl databases.

- The directory in which to start looking for RATS 4 databases.

- The host name of the gretl database server to access.

- The IP number and port number of the HTTP proxy server to use when contacting the database server, if applicable (if you're behind a firewall).

- The calculator and editor programs to launch from the toolbar.

- The monospaced font to be used in gretl screen output.

- The font to be used for menus and other messages. (Note: this item is not present when gretl is compiled for the gnome desktop, since the choice of fonts is handled centrally by gnome.)

There are also some check boxes. Checking the expert box quells some warnings that are otherwise issued. Checking Tell me about gretl updates makes gretl attempt to query the update server at start-up. Unchecking Show gretl toolbar turns the icon toolbar off. If your native language setting is not English and the local decimal point character is not the period (`.`), unchecking Use locale setting for decimal point will make gretl use the period regardless.

Finally, there are some binary choices: Under the Open/Save path tab you can set where gretl looks by default when you go to open or save a file — either the gretl user directory or the current working directory. Under the Data files tab you can set the default filename suffix for data files. The standard suffix is `.gdt` but if you wish you can set this to `.dat`, which was standard in earlier versions of the program. If you set the default to `.dat` then data files will be saved in the traditional format (see ). Also under the Data files tab you can select the action for the little folder icon on the toolbar: whether it should open a listing of the data files associated with Ramanathan's textbook, or those associated with Wooldridge's text.

Under the General tab you may select the algorithm used by gretl for calculating least squares estimates. The default is Cholesky decomposition, which is fast, relatively economical in terms of memory requirements, and accurate enough for most purposes. The alternative is QR decomposition, which is computationally more expensive and requires more temporary storage, but which is more accurate. You are unlikely to need the extra accuracy of QR decomposition unless you are dealing with very ill-conditioned data and are concerned with coefficient or standard error values to more than 7 digits of precision. The option of using QR decomposition can also be activated by setting the environment variable `GRETL_USE_QR` to any non-NULL value.

Settings chosen in this way are handled differently depending on the context. Under MS Windows they are stored in the Windows registry. Under the gnome desktop they are stored in `.gnome/gretl` in the user's home directory. Otherwise they are stored in a file named `.gretlrc` in the user's home directory.

## gretlcli

`gretlcli`

— Opens the program and waits for user input.

`gretlcli` datafile

— Starts the program with the specified datafile in its workspace. The data file may be in native gretl format, CSV format, or BOX1 format (see ). The program will try to detect the format of the file and treat it appropriately. See also for path-searching behavior.

`gretlcli --help` (or `gretlcli -h`)

— Prints a brief summary of usage.

`gretlcli --version` (or `gretlcli -v`)

— Prints version identification for the program.

`gretlcli --pvalue` (or `gretlcli -p`)

— Starts the program in a mode in which you can interactively determine p-values for various common statistics.

`gretlcli --english` (or `gretlcli -e`)

— Force use of English instead of translation.

`gretlcli --run` scriptfile (or `gretlcli -r` scriptfile)

— Execute the commands in scriptfile then hand over input to the command line. See for path-searching behavior.

`gretlcli --batch` scriptfile (or `gretlcli -b` scriptfile)

— Execute the commands in scriptfile then exit. When using this option you will probably want to redirect output to a file. See for path-searching behavior.

When using the `--run` and `--batch` options, the script file in question must call for a data file to be opened. This can be done using the `open` command within the script. For backward compatibility with Ramanathan's original ESL program another mechanism is offered (ESL doesn't have the `open` command). A line of the form:

    	(* ! myfile.gdt *)

will (a) cause gretlcli to load `myfile.gdt`, but will (b) be ignored as a comment by the original ESL. Note the specification carefully: There is exactly one space between the begin comment marker, `(*`, and the `!`; there is exactly one space between the `!` and the name of the data file.

One further kludge enables gretl and gretlcli to get datafile information from the ESL practice files included with the gretl package. A typical practice file begins like this:

`(* PS4.1, using data file DATA4-1, for reproducing Table 4.2 *)`

This algorithm is used: if an input line begins with the comment marker, search it for the string `DATA` (upper case). If this is found, extract the string from the `D` up to the next space or comma, put it into lower case, and treat it as the name of a data file to be opened.

## Path searching

When the name of a data file or script file is supplied to gretl or gretlcli on the command line (see and ), the file is looked for as follows:

1. As is. That is, in the current working directory or, if a full path is specified, at the specified location.

2. In the user's gretl directory (see for the default values).

3. In any immediate sub-directory of the user's gretl directory.

4. In the case of a data file, search continues with the main gretl data directory. In the case of a script file, the search proceeds to the system script directory. See for the default settings.

5. In the case of data files the search then proceeds to all immediate sub-directories of the main data directory.

### Default path settings

| Linux | MS Windows
--- | --- | ---
User directory | `$HOME/gretl` | `PREFIX\gretl\user`
System data directory | `PREFIX/share/gretl/data` | `PREFIX\gretl\data`
System script directory | `PREFIX/share/gretl/scripts` | `PREFIX\gretl\scripts`
Note: `PREFIX` denotes the base directory chosen at the time gretl is installed.

Thus it is not necessary to specify the full path for a data or script file unless you wish to override the automatic searching mechanism. (This also applies within gretlcli, when you supply a filename as an argument to the `open` or `run` commands.)

When a command script contains an instruction to open a data file, the search order for the data file is as stated above, except that the directory containing the script is also searched, immediately after trying to find the data file as is.

### MS Windows

Under MS Windows configuration information for gretl and gretlcli is stored in the Windows registry. A suitable set of registry entries is created when gretl is first installed, and the settings can be changed under gretl's File, Preferences menu. In case anyone needs to make manual adjustments to this information, the entries can be found (using the standard Windows program regedit.exe) under `Software\gretl` in `HKEY_CLASSES_ROOT` (the main gretl directory and the command to invoke gnuplot) and `HKEY_CURRENT_USER` (all other configurable variables).