Random Effects & Hausman Test

ECON 3209 · Week 17, Lecture 3 · Kerala Agricultural University

Department of Development Economics, KAU

Autumn 2026

Learning Outcomes

By the end of this lecture, you should be able to:

  1. state the random-effects model and the key exogeneity assumption behind it
  2. understand quasi-demeaning and the GLS intuition of random effects
  3. compare manual FE and RE estimates in Python without linearmodels
  4. explain the logic of the Hausman test
  5. decide when FE or RE is more credible in an applied panel setting

Random Effects Model

  • In random effects (RE), the unit-specific effect \(\alpha_i\) is part of the composite error:

\[y_{it}=\beta_0 + x_{it}'\beta + \alpha_i + u_{it}\]

  • RE assumes \(\alpha_i\) is uncorrelated with the regressors for all time periods.
  • This is stronger than FE, but if true, RE is more efficient and can estimate time-invariant regressors.

GLS and Quasi-Demeaning

  • RE uses feasible GLS to account for the error structure.
  • The transformed variables subtract a fraction \(\theta\) of each unit mean rather than the full mean:

\[y^*_{it}=y_{it}-\theta \bar{y}_i\]

  • If \(\theta=1\), we get FE demeaning.
  • If \(\theta=0\), we get pooled OLS.
  • So RE lies between pooled OLS and FE.

Why FE versus RE Is an Assumption Choice

  • If district effects are correlated with fertilizer, RE is inconsistent and FE is safer.
  • If district effects are truly uncorrelated with the regressors, RE is attractive because it is more efficient.
  • Applied work often estimates both and then compares them.

Simulated Panel for FE and RE

Manual FE and RE Estimation

Hausman Test Logic

  • Null hypothesis: RE is consistent, so FE and RE should be close except for sampling noise.
  • Alternative: RE is inconsistent because unit effects are correlated with regressors.
  • If FE and RE differ systematically, prefer FE.
  • Hausman is therefore a test of the RE exogeneity assumption.

A Simple Hausman Calculation

When RE Has an Advantage

  • RE can estimate time-invariant regressors such as coastal location or a permanent branch category.
  • FE drops such regressors automatically.
  • So if the RE assumption is credible, it can deliver more information than FE.

Kerala Interpretation

If permanent district characteristics such as soil quality or irrigation culture are correlated with fertilizer use, FE is safer.

If those permanent effects are unrelated to the regressors, RE may be efficient and can estimate time-invariant factors like coastal location.

Decision Rule for Applied Work

  • Estimate pooled OLS for a benchmark.
  • Estimate FE when correlation between unit effects and regressors is plausible.
  • Estimate RE when the strict exogeneity assumption appears reasonable and time-invariant regressors matter.
  • Use the Hausman test as supporting evidence, not as a substitute for economic judgement.

Exercise

Using the starter code, compute FE and RE estimates for the fertilizer effect. If the Hausman p-value is small, which model would you trust and why?

Summary

  • ✅ Random effects treat the unit effect as uncorrelated with regressors and use GLS-style quasi-demeaning.
  • ✅ FE is more robust when that exogeneity assumption is doubtful.
  • ✅ The Hausman test checks whether FE and RE differ more than sampling noise would suggest.
  • ✅ Model choice in panel data depends on both statistical evidence and the economics of the setting.

Next Lecture

  • We begin autocorrelation by studying serially correlated errors over time.
  • You will see AR(1) processes and why time series errors violate the usual OLS assumptions.
  • From panels we move to dynamics in pure time series data.