Random Effects and the Hausman Test
Random effects (RE) estimates by feasible GLS rather than by full demeaning. It applies a partial (quasi) demeaning governed by a factor , so it keeps part of the between variation alongside the within variation. That makes RE more efficient than fixed effects and lets it estimate time-invariant regressors that FE wipes out. The price is a strong assumption. RE is consistent only when the unobserved effect is uncorrelated with the regressors in every period, for all , on top of strict exogeneity of . If that orthogonality fails, RE is biased and inconsistent and FE is the safer choice.
Why it matters
Fixed effects throws away all between-firm variation to purge , which is robust but wasteful and silent on anything that never changes. Random effects instead treats as a random draw and removes only a fraction of each unit mean, recovering efficiency and time-invariant slopes. The catch is that RE only works if the unobserved heterogeneity is unrelated to the regressors. The Hausman test is the formal referee. It asks whether FE and RE disagree by more than sampling noise. If they agree, keep the efficient RE estimator. If they diverge significantly, the RE assumption has failed and you fall back to FE.
Formulas
Worked examples
Estimate a wage equation on a panel of workers by random effects in Stata.
After `xtset id year`, run `xtreg lwage educ exper expersq union, re`. Because RE keeps between variation, the time-invariant `educ` coefficient is reported, unlike under FE. The output also prints `theta`, the quasi-demeaning factor, and `rho`, the share of total variance due to .
Decide between FE and RE for the same wage equation using a Hausman test.
Estimate and store both models, then compare them: `xtreg lwage exper expersq union, fe` then `estimates store fe`, then `xtreg lwage exper expersq union, re` then `estimates store re`, then `hausman fe re`. Suppose the result is with a p-value of 0.001. You reject the null that RE is consistent, so the RE orthogonality assumption fails and you report the FE estimates.
Common mistakes
- ✗Reading the Hausman test backwards. Rejecting the null does NOT mean use RE. The null is that RE is consistent, so a rejection says the RE assumption fails and you should use FE.
- ✗Believing RE is always better because it is more efficient. The efficiency gain is real only if the orthogonality assumption holds. If it fails, RE is simply biased, and a more precise wrong answer is still wrong.
- ✗Running `hausman fe re` after a cluster-robust or robust VCE. The classical Hausman test assumes one estimator is fully efficient under the null, which clustered standard errors break, so it can return a negative or undefined statistic. Use an auxiliary-regression version such as the Mundlak (cluster-robust) test instead.
- ✗Thinking FE and RE estimate different parameters. Under the RE null they estimate the same , which is exactly why their difference is informative. The test exploits that one estimator stays consistent while the other does not when the assumption fails.
Revision bullets
- •RE is FGLS with partial demeaning by , using both within and between variation.
- •RE is more efficient than FE and can estimate time-invariant regressors, but only if for all .
- •Hausman null: RE is consistent and efficient. The two estimators should be close under the null.
- •Reject the Hausman null means the RE assumption fails, so use FE. Fail to reject means keep RE.
- •Stata sequence: `xtreg y x, fe`, `estimates store fe`, `xtreg y x, re`, `estimates store re`, then `hausman fe re`.
- •The classical `hausman` command is not valid after a robust or clustered VCE. Use a Mundlak auxiliary-regression test there.
Quick check
A Hausman test comparing FE and RE returns with a p-value of 0.000. What should you conclude?
Why is random effects able to estimate the coefficient on a time-invariant regressor such as years of schooling, while fixed effects cannot?
Connected topics
Sources
- Wooldridge (2019), §14.2Wooldridge, Jeffrey M. Introductory Econometrics: A Modern Approach. 7th ed. Cengage, 2019.Develops the random effects estimator as quasi-demeaned FGLS, the role of , and the orthogonality assumption that RE requires.
- Wooldridge (2019), §14.2 (FE vs RE)Wooldridge, Jeffrey M. Introductory Econometrics: A Modern Approach. 7th ed. Cengage, 2019.Discusses the Hausman test for choosing between fixed and random effects, where rejection of the null points to fixed effects.