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


In appendix 10F of POE4, the authors conduct a Monte Carlo experiment comparing the performance of OLS and TSLS. The basic simulation is based on the model

y = x + e (10.7)

x = nz1 + nz2 + nz3 + v (10.8)

The Zi are exogenous instruments that are each N(0,1). The errors, e and v, are

The parameter n controls the strength of the instruments and is set to either 0.1 or 0.5. The parameter p controls the endogeneity of x. When p = 0, x is exogenous. When p = 0.8 it is seriously endogenous. Sample size is set to 100 and 10,000 simulated samples are drawn.

The gretl script to perform the simulation appears below:

1 scalar N = 100

2 nulldata N

3 scalar rho =0.8 # set r = (0.0 or 0.8)

4 scalar p = 0.5 # set p = (0.1 or 0.5)

5 matrix S = {1, rho; rho, 1}

6 matrix C = cholesky(S)


7 series z1 = norm...

Read More

Hausman Test

The Hausman test probes the consistency of the random effects estimator. The null hypothesis is that these estimates are consistent-that is, that the requirement of orthogonality of the model’s errors and the regressors is satisfied. The test is based on a measure, H, of the “distance” between the fixed-effects and random-effects estimates, constructed such that under the null it follows the X2 distribution with degrees of freedom equal to the number of time-varying regressors, J. If the value of H is “large” this suggests that the random effects estimator is not consistent and the fixed-effects model is preferable.

There are two ways of calculating H, the matrix-difference method and the regression method. The procedure for the matrix-difference method is this:

• Collect the fix...

Read More

Time-Varying Volatility and ARCH Models: Introduction to Financial Econometrics

In this chapter we’ll estimate several models in which the variance of the dependent variable changes over time. These are broadly referred to as ARCH (autoregressive conditional heteroskedas – ticity) models and there are many variations upon the theme.

The first thing to do is illustrate the problem graphically using data on stock returns. The data are stored in the gretl dataset returns. gdt. The data contain four monthly stock price indices: U. S. Nasdaq (nasdaq), the Australian All Ordinaries (allords), the Japanese Nikkei (nikkei) and the U. K. FTSE (ftse). The data are recorded monthly beginning in 1988:01 and ending in 2009:07. Notice that with monthly data, the suffix is two digits, that is 1988:01 is January (01) in the year 1988.

Simple scatter plots appear below...

Read More


Two nonstationary series are cointegrated if they tend to move together through time. For instance, we have established that the levels of the Fed Funds rate and the 3-year bond are non­stationary, whereas their differences are stationary. In the opaque language used in time-series
literature, each series is said to be “integrated of order 1” or I(1). If the two nonstationary series move together through time then we say they are “cointegrated.” Economic theory would suggest that they should be tied together via arbitrage, but that is no guarantee. In this context, testing for cointegration amounts to a test of the substitutability of these assets.

The basic test is very simple. Regress one I(1) variable on another using least squares...

Read More


The tobit model is essentially just a linear regression where some of the observations on your dependent variable have been censored. A censored variable is one that, once it reaches a limit, it is recorded at that limit no matter what it’s actual value might be. For instance, anyone earning $1 million or more per year might be recorded in your dataset at the upper limit of $1 million. That means that Bill Gates and the authors of your textbook earn the same amount in the eyes of your dataset (just kidding, gang). Least squares can be seriously biased in this case and it is wise to use a censored regression model (tobit) to estimate the parameters of the regression when a portion of your sample is censored.

Hill et al. (2011) consider the following model of hours worked for a sample of w...

Read More


The basic ARCH(1) model can be expressed as:

yt = в + et


et|1t-i ~ N(0, ht)


ht = ao + aqe2_i


a0 > 0, 0 < a1 < 1

The first equation describes the behavior of the mean of your time-series. In this case, equation (14.1) indicates that we expect the time-series to vary randomly about its mean, в. If the mean of your time-series drifts over time or is explained by other variables, you’d add them to this equation just as you would a regular regression model. The second equation indicates that the error of the regression, et, are normally distributed and heteroskedastic. The variance of the current period’s error depends on information that is revealed in the preceding period, i. e., It_i. The variance of et is given the symbol ht...

Read More