G. Onel
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.
ii. Make sure that each column of data is headed by a variable name that (a) begins with
a letter and (b) is no longer than eight contiguous characters in length.
iii. Make sure that, aside from the column headings, all of the data consists of
numbers. Gretl will ignore alphanumeric values so be sure to first convert categorical variables
(e.g., yes, no) into numerical variables (e.g., 1, 0). NOTE: you can use Excel's *Edit* Replace*
to do the conversion.
iv. To save the data, click on * File * Save As * and then type in a file name and click
on MS Excel Comma Delimited File (csv) as the file type.
B. To import the saved Excel (csv) worksheet into Gretl :
Start Gretl and click on * File * Open Data * User File *, change the file type (bottom
right) to CSV, and then point to the folder containing the data. Next respond to the query on
whether the data is undated or time-series or panel. If the data is either time-series or panel,
you'll have to enter additional information regarding how the data is measured, i.e., the starting
date for the data, the number of time-periods, etc. After you have imported the data, doubleclick on the variable names to check that the program processed the data correctly.
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 *.
X. Subsamples
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.
XI. Panel Data Regressions
To analyze panel data in Gretl , click on * Model * * Panel * * Fixed or Random
Effects*, identify the dependent variable and independent variables and the model you wish to
estimate, indicate whether you want time dummies included, and then click on * OK *. The *
3
Tests * tab will generate additional statistics including tests for heteroskedasticity and serial
correlation.
XII. Saving Projects
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 Gretl , 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.
XIII. Exercise
In the following data, Y is the weight (in pounds) of each customer and X is the height (in inches
above 5 feet):
Y
140
157
205
198
162
174
150
165
170
180
170
162
165
180
160
155
165
190
185
155
X
5
9
13
12
10
11
8
9
10
12
11
9
10
12
8
9
10
15
13
11
a-) Create a data set, using EXCEL, containing the above data. Put the two variable names,
i.e., Y and X, on the first line of the data file. Type in the numbers on the next 20 lines,
organized into two columns. This is organizing the file's data by observation. Save the data into
a file formatted as an MS Excel Comma Delimited File (csv) worksheet.
b-) Use the Gretl program to generate descriptive statistics, i.e., means, standard deviations and
correlation coefficients for the Y and X variables. Note: this data is cross-sectional data, i.e., it's
measured across individuals at a point of time.
c-) Explain what the descriptive statistics mean.
d-) Generate a scatterplot of Y and X and discuss what it shows.
e-) Write a regression model (equation) that describes the likely relationship between Y and X.
Which is the dependent variable? The independent variable? Why so? Discuss what the
equation hypothesizes.
f-) Estimate your regression model and also generate predicted Y values and residuals.
g-) Specifically, what do the observed Y, fitted (predicted) Y, and residual columns tell you?
How are they computed?
h-) Interpret the estimated coefficients.