Gretl Manual: Gnu Regression, Econometrics and Time-series Library
Prev | Chapter 3. Modes of working | Next

# The Session concept

## Introduction

`gretl` offers the idea of a "session" as a way of keeping track of your work and revisiting it later. The basic idea is to provide an iconic space containing various objects pertaining to your current working session (see Figure 3-2). You can add objects (represented by icons) to this space as you go along. If you save the session, these added objects should be available again if you re-open the session later.

Figure 3-2. Icon view: one model and one graph have been added to the default icons

If you start `gretl` and open a data set, then select "Icon view" from the Session menu, you should see the basic default set of icons: these give you quick access to the command script ("Session"), information on the data set (if any), correlation matrix ("Correlations") and descriptive summary statistics ("Summary"). All of these are activated by double-clicking the relevant icon. The "Data set" icon is a little more complex: double-clicking opens up the data in the built-in spreadsheet, but you can also right-click on the icon for a menu of other actions.

To add a model to the session view, first estimate it using the Model menu. Then pull down the File menu in the model window and select "Save to session as icon…" or "Save as icon and close". Simply hitting the `S` key over the model window is a shortcut to the latter action.

To add a graph, first create it (under the Data menu, "Graph specified vars", or via one of `gretl`'s other graph-generating commands). Click on the graph window to bring up the graph menu, and select "Save to session as icon".

Once a model or graph is added its icon should appear in the Icon View window. Double-clicking on the icon redisplays the object, while right-clicking brings up a menu which lets you display or delete the object. This popup menu also gives you the option of editing graphs.

## The model table

In econometric research it is common to estimate several models with a common dependent variable — the models differing in respect of which independent variables are included, or perhaps in respect of the estimator used. In this situation it is convenient to present the regression results in the form of a table, where each column contains the results (coefficient estimates and standard errors) for a given model, and each row contains the estimates for a given variable across the models.

In the Icon View window `gretl` provides a means of constructing such a table (and copying it in plain text, LaTeX or Rich Text Format). Here is how to do it:[1]

1. Estimate a model which you wish to include in the table, and in the model display window, under the File menu, select "Save to session as icon" or "Save as icon and close".

2. Repeat step 1 for the other models to be included in the table (up to a total of six models).

3. When you are done estimating the models, open the icon view of your gretl session, by selecting "Icon view" under the Session menu in the main gretl window, or by clicking the "session icon view" icon on the gretl toolbar.

4. In session icon view, there is an icon labeled "Model table". Decide which model you wish to appear in the left-most column of the model table and add it to the table, either by dragging its icon onto the Model table icon, or by right-clicking on the model icon and selecting "Add to model table" from the pop-up menu.

5. Repeat step 4 for the other models you wish to include in the table. The second model selected will appear in the second column from the left, and so on.

6. When you are finished composing the model table, display it by double-clicking on its icon. Under the Edit menu in the window which appears, you have the option of copying the table to the clipboard in various formats.

7. If the ordering of the models in the table is not what you wanted, right-click on the model table icon and select "Clear table". Then go back to step 4 above and try again.

A simple instance of `gretl`'s model table is shown in Figure 3-3.

Figure 3-3. Example of model table

## The graph page

The "graph page" icon in the session window offers a means of putting together several graphs for printing on a single page. This facility will work only if you have the LaTeX typsetting system installed, and are able to generate and view PostScript output.[2]

In the Icon View window, you can drag up to eight graphs onto the graph page icon. When you double-click on the icon (or right-click and select "Display"), a page containing the selected graphs (in EPS format) will be composed and opened in your postscript viewer. From there you should be able to print the page.

To clear the graph page, right-click on its icon and select "Clear".

On systems other than MS Windows, you may have to adjust the setting for the program used to view postscript. Find that under the "Programs" tab in the Preferences dialog box (under the "File" menu in the main window). On Windows, you may need to adjust your file associations so that the appropriate viewer is called for the "Open" action on files with the `.ps` extension.

## Saving and re-opening sessions

If you create models or graphs that you think you may wish to re-examine later, then before quitting `gretl` select "Save as…" from the Session menu and give a name under which to save the session. To re-open the session later, either

- Start `gretl` then re-open the session file by going to the "Open" item under the Session menu, or

- From the command line, type `gretl -r` `sessionfile`, where `sessionfile` is the name under which the session was saved.

### Notes

[1] | The model table can also be built non-interactively, in script mode. For details on how to do this, see the modeltab command.
[2] | Specifically, you must have `dvips` and `ghostscript` installed, along with a viewer such as `gv`, `ggv` or `kghostview`. The default viewer for systems other than MS Windows is `gv`.

Prev | Home | Next
The gretl console | Up | Data files