I fit several two level models in SAS using PROC MIXED: an empty model with multilevel structure (null), a model with a level 2 covariate (partial model), and a model with level 1 and level 2 covariates (full model).

SAS estimated the random intercepts for all models, and the random effect covariate in the partial model, but in the full model the estimates for the random effect were all 0. My colleague suggested this because the covariate is a poor predictor in the presence of the level 1 covariates, that within group variation may be larger than between group variation, and that I should do a Hausman's test to see whether the multilevel structure is needed.

As I understand it, Hausman's test is

$W = \frac{(\hat{\beta}_{FE}^\star - \hat{\beta}_{RE}^\star)}{Var(\hat{\beta}_{FE}^\star) - Var(\hat{\beta}_{RE}^\star)}$

which approximates a $\chi^2$ distribution with 1 degree of freedom, where $\hat{\beta}_{FE}^\star$ is the estimated beta coefficient from the fixed effects model, $\hat{\beta}_{RE}^\star$ is the estimated beta coefficient from the random effects model, and $Var(\hat{\beta}_{FE}^\star)$ and $Var(\hat{\beta}_{RE}^\star)$ are their variances. The relationship to the chi-square distribution is intuitive and it is easy to see how to implement this for a single coefficient.

My question is whether I should calculate $W$ for each $\beta$ in my model (i.e. level 1 covariates and the level 2 covariate) or just the random effects covariate.


You should use the Hausman test for testing $E\left(x'c\right)=0$ where $c$ is the time constant unobserved heterogeneity and $x$ is the vector of covariates. The RE model gives more efficient estimates than FE model but if $E\left(x'c\right)=0$ does not hold then the RE model will give inconsistent estimates while the FE will estimate the parameters consistently, hence the FE model should be used.

The Hausman test is given as:


where $\hat{\beta}_{RE}$ is the $\left(M\: x\:1\right)$ vector of random effects estimates excluding the estimates for time invariant variables!

Note that if you are only interested in one parameter, then the Hausman test is: $$H=\left(\hat{\beta}_{FE}^{j}-\hat{\beta}_{RE}^{j}\right)^{'}\left[se\left(\hat{\beta}_{FE}^{j}\right)^{2}-se\left(\hat{\beta}_{RE}^{j}\right)^{2}\right]^{-\frac{1}{2}}\backsim N\left(0,1\right)$$

What you should do is to estimate your FE model and your RE model. Then compute the Hausman statistics. Note that the RE and the FE models need to be specified in the same manner (i.e. the same explanatory variables) otherwise the Hausman test is invalid. Further, if you are only interested in testing one parameter you should use the alternative Hausman test which is normally distributed, not $\chi^{2}$! One last point to note is that if you are interested in testing more than one parameter then an F-test should be used.

Hope it made sense!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.