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

Using gretl’s vecm Command

The Australian/U. S. GDP example above was carried out manually in a series of steps in order to familiarize you with the structure of the VEC model and how, at least in principle, they are estimated. In most applications, you will probably use other methods to estimate the VECM; they provide additional information that is useful and are usually more efficient. Gretl contains a full-featured vecm command that estimates a VECM. Chapter 24 of Cottrell and Lucchetti (2011) provides an excellent tutorial on estimating a VECM and includes some examples using gretl. Before using the vecm command in gretl, this is required reading!

One feature of the example in POE4 that bothers me is that tests for autocorrelation in the error correction models reject the no serial correlation hypothesis...

Read More

Ways to Use R in gretl

The standard method of working with R is by writing scripts, or by typing commands at the R prompt, much in the same way as one would write gretl scripts or work with the gretl console. This section is a gentle introduction to using R in general with a few tips on using it with gretl. As you will see, there are several ways in which to use R in gretl.

D. 1.1 Using the foreign command

In section 10.3.4 a foreign statement was used to actually execute R routines from within gretl and to pass results to gretl for further processing. A foreign block has the basic structure:

————————- Basic foreign block for R

1 foreign language=R —send-data —quiet

2 [ R code to create a matrix called ‘Rmatrix’ ]

3 gretl. export(Rmatrix)

4 end foreign

5

5 matrix m = mread("@dotdir/Rmatrix. mat")

The foreign...

Read More

Sargan Test

The final test is the Sargan test of the overidentifying restrictions implied by an overidentified model. Recall that to be overidentified just means that you have more instruments than you have endogenous regressors. In our example we have a single endogenous regressor (educ) and two instruments, (mothereduc and fatehreduc). The first step is to estimate the model using TSLS using all the instruments. Save the residuals and then regress these on the instruments alone. TR2 from this regression is approximately x2 with the number of surplus instruments as your degrees of freedom. Gretl does this easily since it saves TR2 as a part of the usual regression output, where T is the sample size (which we are calling N in cross-sectional examples). The script for the Sargan test follows:

1 open "@...

Read More

Random Effects

The random effects estimator treats the individual differences as being randomly assigned to the individuals. Rather than estimate them as parameters as we did in the fixed effects model, here they are incorporated into the model’s error, which in a panel will have a specific structure. The ви term in equation 15.3 is modeled:

віі = ві + Ui (15.5)

where the Ui are random individual differences that are the same in each time period.

Vit = ві + в2Х2 it + взхзи + (eit + Ui)
= ві + в2Х2 it + взХз it + Vit

where the combined error is

vit — ui + eit

the key property of the new error term is that it is homoskedastic

o — var (vit) — var (ui + eit) — oU + ol

and serially correlated. For individual i, that covariance among his errors is

cov (Vit, Vis) — oU

for i — ...

Read More

Tests for Stationarity

The (augmented) Dickey-Fuller test can be used to test for the stationarity of your data. To perform this test, a few decisions have to be made regarding the time-series. The decisions are usually made based on visual inspection of the time-series plots. By looking at the plots you can determine whether the time-series have a linear or quadratic trend. If the trend in the series is quadratic then the differenced version of the series will have a linear trend in them. In Figure 12.1 you can see that the Fed Funds rate appears to be trending downward and its difference appears to wander around some constant amount. Ditto for bonds. This suggests that the Augmented Dickey Fuller test regressions for each of the series should contain a constant, but not a time trend.

The GDP series in the uppe...

Read More

Ordered Probit

In this example, the probabilities of attending no college, a 2 year college, and a 4 year college after graduation are modeled as a function of a student’s grades. In principle, we would expect that those with higher grades to be more likely to attend a 4 year college and less likely to skip college altogether. In the dataset, grades are measured on a scale of 1 to 13, with 1 being the highest. That means that if higher grades increase the probability of going to a 4 year college, the coefficient on grades will be negative. The probabilities are modeled using the normal distribution in this model where the outcomes represent increasing levels of difficulty.

We can use gretl to estimate the ordered probit model because its probit command actually handles multinomial ordered choices as we...

Read More