Using gret l for Principles of Econometrics, 4th Edition
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 fixed-effects estimates in a vector, /, and the corresponding random-effects estimates in /, then form the difference vector (/ — /3)
• Form the covariance matrix of the difference vector as var(/ — /) = var(/) — var(/) = Ф. The two variance covariance matrices are estimated using the sample variance matrices of the fixed - and random-effects models respectively.
• Compute the quadratic form H = (/ — Ф-1(/ — /) ~ Xj if the errors and regressors are not correlated.
Given the relative efficiencies of / and /3, the matrix Ф “should be” positive definite, in which case H is positive, but in finite samples this is not guaranteed and of course a negative x2 value is not admissible.
The regression method avoids this potential problem. The procedure is:
• Treat the random-effects model as the restricted model, and record its sum of squared residuals as SSRr.
• Estimate via OLS an unrestricted model in which the dependent variable is quasi-demeaned y and the regressors include both quasi-demeaned X (as in the RE model) and the demeaned variants of all the time-varying variables (i. e. the fixed-effects regressors); record the sum of squared residuals from this model as SSRu.
• Compute H = n(SSRr — SSRu)/SSRu, where n is the total number of observations used. On this variant H cannot be negative, since adding additional regressors to the RE model cannot raise the SSR. See chapter 16 of the Gretl Users Guide for more details.
By default gretl computes the Hausman test via the regression method, but it uses the matrix difference method if you pass the option —matrix-diff to the panel command.
In the wage example, the Hausman test results are:
Null hypothesis: GLS estimates are consistent Asymptotic test statistic: Chi-square(6) = 20.5231 with p-value = 0.00223382