1 · Panel data & unobserved heterogeneity
What panel data is, why repeated observations on the same entities help, and how an unobserved entity effect αᵢ creates correlation that biases naive regression.
Unobserved heterogeneity, pooled-OLS bias, the within estimator, FE vs RE.
Course overview
This free course uses real Python and statsmodels in your browser. Work through the modules below with explanations, executable examples, interactive controls, and questions.
What panel data is, why repeated observations on the same entities help, and how an unobserved entity effect αᵢ creates correlation that biases naive regression.
Pooled OLS ignores the panel structure and treats αᵢ as part of the error. We show, in code and with a slider, that this biases β₁ whenever αᵢ correlates with x.
Fixed effects estimate β₁ from within-entity variation only, sweeping out αᵢ. We do it two equivalent ways — entity dummies and hand-coded demeaning — and confirm both kill the bias.
Random effects treats αᵢ as random noise uncorrelated with x, gaining efficiency and time-invariant coefficients — but only if that assumption holds. The Hausman idea tells you which to trust.