| Eco310 Econometrics | Dr. Robert Jantzen |
A Brief Guide to the Gretl Program
| I. Introduction
The Gretl regression program is a powerful freeware program available for download from the SourceForge website. It is an open source Econometric program and will operate on computers running the Windows, MAC OS X or Linux operating systems. The manual for the Gretl program is available at: http://www.learneconometrics.com/gretl/using_gretl_for_POE4.pdf
II. Downloading and Installing the Gretl Program A. The Gretl program for Windows is available for download at the following link: http://prdownloads.sourceforge.net/gretl/gretl-1.9.7.exe To install the software, type the above link into your internet browser and click on * Run * when prompted. At the prompts, accept the installation defaults and the program will then create an icon on your desktop for Gretl. Double-click on the desktop icon to start the program. NOTE: If you plan to utilize the program exclusively in the Iona computer labs, you can avoid repeatedly downloading the program file by saving the file to your local U: drive. In order to do so, first type the above program link into your browser. Second, when asked whether you want to Run the program or Save it, choose Save and have the program saved to your local U: drive. After the download is completed, click on Run when prompted, accept the installation defaults and a Gretl icon will be created on your desktop. In order to use the use the Gretl program anytime in the future, all you have to do is open your U: drive and double click on the gretl-1.9.7.exe file. B. Instructions for installing the Gretl program on MAC OS X are available at the following link: http://gretl.sourceforge.net/osx.html You’ll have to first download and run the appropriate
GTK
library (Step 2) and then the Current Snapshot that corresponds
to your OS version.
III. Preparing and Importing Excel data files The "recommended" way to analyze data using the Gretl program is to first create an Excel workbook, and then "import" the data into the program. NOTE: Like most statistical programs, importing data works best when the data have been saved as MS Excel comma delimited file (csv) worksheets. A. To create and save data into a MS Excel comma delimited file (csv) worksheets:
i. Start the MS-Excel program and either (a) type in the data
to a blank worksheet or (b) open a saved Excel file and click on the worksheet
containing the data to be imported.
B. To import the saved Excel worksheet into the Gretl program:
Start Gretl and click on * File * Open Data * Import * Text/csv
* OK *. Then point to the folder containing the data and
respond to query on whether the data is undated or time-series. If
the data is time-series, you'll have to enter the starting date for the
data and whether the data is annual, quarterly, monthly, etc. After
you have imported the data, double-click on the variable names to check
that the program processed the data correctly.
IV. Descriptive Statistics and Simple Plots To obtain Descriptive Statistics, highlight the variable names that you want statistics for and then click on * View * Summary Statistics * OK *. To obtain correlation coefficients, click on * View * Correlation Matrix * *OK*. To obtain Simple Bivariate Plots,
click * View * Graph specified vars * X-Y scatter * and then identify
the variables you want to plot on the X and Y axes.
V. Ordinary Least Squares Regression To run an Ordinary Least
Squares (OLS) regression in the Gretl program, click on * Model
* * Ordinary Least Squares *, identify the dependent variable
and independent variables, and then click on * OK *. The *
Analysis * tab will generate additional statistics including predicted
values and residuals and confidence intervals for the coefficients.
The * Graphs * tab will generate differing plots of the residuals.
VI. Testing and correcting for serial (auto) correlation Gretl will
generate the Durbin Watson Statistic after an ordinary least squares regression
is estimated. The results for the Breusch-Godfrey test for
autocorrelation can also be obtained by clicking on * Tests * Autocorrelation
* and entering the desired number of lags. To estimate
Generalized Least Squares (GLS) corrected results, click on *
Model * Times Series *, select the estimation method (e.g., Autoregressive
Estimation) and then identify the dependent and independent variables and
the number of AR term lags (usually 1). To estimate Newey-West
corrected standard error results, run an Ordinary Least Squares (OLS) regression
but also click on * Robust standard errors * Configure * and on
the * HCCE * tab make sure that * HAC * is highlighted for
*
time series data *.
VII. Testing and correcting for heteroskedasticity After an ordinary
least squares regression is estimated, you can test for heteroskedasticity
by clicking on * Tests * Heteroskedasticity * and entering the desired
test, e.g., White Test. To estimate corrected results,
run an Ordinary Least Squares regression but also click on * Robust
standard errors * Configure * and on the * HCCE * tab make sure
that the desired correction method (e.g., HC1) is highlighted for *
cross sectional data *.
To generate a logit regression
model on a binary dummy (1,0) dependent variable, click on *Model* *
Nonlinear Models * Logit * Binary *, and then identify the dependent
and independent variables. Gretl will then generate
logit results, including transformed coefficients measuring the marginal
impacts of the explainers evaluated at their mean values.
New
variables can be created out of existing ones by clicking on * Add *
New Variable * and then typing in the formula for computing the new
variable. For example if you wanted to multiple X1 times
X2
to create an interactive variable named X1X2, then click on *
Add * New Variable * and type in the formula box
X1X2 = X1 * X2 . Make sure that if the variable names are capitalized,
your formula includes capitalized names.
To select subsamples of the data set, click on * Sample * and * Set Range * and then define the range of observations that you want to include in the analyses that will follow. You can also use the * Sample * command to include a random sample of observations or to define expressions that will select/reject those cases that conform to the expression. To create a "script" file containing commands, click on * File * Script Files* New Script *. Then type in the script commands. To execute, "highlight" those commands that you want Gretl to process and click on the * Run * icon. If you
want to save an Gretl session for future analysis, and want to avoid
re-importing the Excel data worksheet and recreating any data transformations
that you've already done, then you must get Gretl to save your project.
To do so, click on * File * Save Data *, point to the folder where
you want the project saved, and name the project. Then
you can reopen the project by starting the Gretl program, clicking
on * File * Open Data * User File *, and then entering the saved
project's name. Gretl will recreate all of the variables that were
available at the time the project was saved.
|