Category Using gret l for Principles of Econometrics, 4th Edition

Vector Autoregression

The vector autoregression model (VAR) is actually a little simpler to estimate than the VEC model. It is used when there is no cointegration among the variables and it is estimated using time-series that have been transformed to their stationary values.

In the example from POE4, we have macroeconomic data on RPDI and RPCE for the United States. The data are found in the fred. gdt dataset and have already been transformed into their natural logarithms. In the dataset, y is the log of real disposable income and c is log of real consumption expenditures. As in the previous example, the first step is to determine whether the variables are stationary. If they are not, then you transform them into stationary time-series and test for cointegration.

The data need to be analyzed in the same way as ...

Read More

A few basic commands and conventions

The first thing I usually do is to change the name to something less generic, e. g., cola, using

> cola <-gretldata

You can also load the current gretl data into R manually as shown below. To load the data in properly, you have to locate the Rdata. tmp file that gretl creates when you launch R from the GUI. Mine was cleverly hidden in C:/Users/Lee/AppData/Roaming/gretl/Rdata. tmp. Once found, use the read. table command in R as shown. The system you are using (Windows in my case) dictate whether the slashes are forward or backward. Also, I read the data in as cola rather than the generic gretldata to make things easier later. R.

> cola <- read. table("C:/Users/Lee/AppData/Roaming/gretl/Rdata. tmp", + header = TRUE )

The addition of Header = TRUE to the code that gretl writes for you ensure...

Read More

Multiple Endogenous Regressors and the Cragg-Donald F-test

3Cragg and Donald (1993) have proposed a test statistic that can be used to test for weak identification (i. e., weak instruments). In order to compute it manually, you have to obtain a set of canonical correlations. These are not computed in gretl so we will use another free software, R, to do part of the computations. On the other hand, gretl prints the value of the Cragg-Donald statistic by default so you won’t have to go to all of this trouble. Still, to illustrate a very powerful feature of gretl we will use R to compute part of this statistic.

One solution to identifying weak instruments in models with more than one endogenous regressor is based on the use of canonical correlations...

Read More

Between Estimator

Before discussing such tests, another estimator of the model’s parameters deserves mention. The between estimator is also used in some circumstances. The between model is

yi = ві + в2Х2 І + взХз І + Ui + ei (15.11)

where the yi is the average value of y for individual i, and xki is the average value of the kth regressor for individual i. Essentially, the observation in each group (or individual) are averaged over time. The parameters are then estimated by least squares. The variation between individuals is being used to estimate parameters. The errors are uncorrelated across individuals and homoskedastic and as long as individual differences are not correlated with regressors, the between estimator should be consistent for the parameters.

To obtain the between estimates, simply...

Read More

Other Tests for Nonstationarity

There are other tests for nonstationarity in gretl that you may find useful. The first is the DF-GLS test. It performs the modified Dickey-Fuller t-test (known as the DF-GLS test) proposed by Elliott et al. (1996). Essentially, the test is an augmented Dickey-Fuller test, similar to the test performed by gretl’s adf command, except that the time-series is transformed via a generalized least squares (GLS) regression before estimating the model. Elliott et al. (1996) and others have shown that this test has significantly greater power than the previous versions of the augmented Dickey-Fuller test. Consequently, it is not unusual for this test to reject the null of nonstationarity when the usual augmented Dickey-Fuller test does not.

The —gls option performs the DF-GLS test for a series of ...

Read More

Poisson Regression

When the dependent variable in a regression model is a count of the number of occurrences of an event you may want to use the poisson regression model. In these models, the dependent variable is a nonnegative integer, (i. e., y = 0,1,…), which represent the number of occurrences of a particular event. The probability of a given number of occurrences is modeled as a function of independent variables.


P (Y = y|x) = – y – y = 0,1, 2,… (16.17)

where A = ві + в2х is the regression function.

Estimating this model using maximum likelihood is very simple since the MLE of the poisson regression model is already programmed into gretl. The syntax for a script is the same as for linear regression except you use the possion command in place of ols...

Read More