Fixed Effects

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

Department of Development Economics, KAU

Autumn 2026

Learning Outcomes

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

  1. explain why fixed effects control for time-invariant omitted variables
  2. write the within estimator and understand demeaning
  3. estimate fixed effects manually and with dummy variables in Python
  4. compare pooled OLS and fixed-effects estimates
  5. recognise which variables fixed effects can and cannot identify

Why Fixed Effects?

  • Suppose each district has a permanent, unobserved characteristic: soil quality, altitude, irrigation culture, or extension support.
  • If this time-invariant factor is correlated with fertilizer use, pooled OLS is biased.
  • Fixed effects (FE) remove these unit-specific constants.

Within Estimator Formula

\[\ddot{y}_{it} = \ddot{x}_{it}'\beta + \ddot{\varepsilon}_{it}\]

where

\[\ddot{y}_{it}=y_{it}-\bar{y}_i\]

  • Demeaning subtracts each unit’s average from the original data.
  • All time-invariant district effects cancel out.

Intuition of Demeaning

  • FE compares a district to itself over time.
  • It asks: when fertilizer rises above a district’s own average, does productivity also rise above that district’s own average?
  • This removes bias from time-constant omitted factors.
  • It does not remove time-varying omitted variables.

Manual Demeaning in Python

LSDV: Least Squares Dummy Variables

  • Another way to estimate FE is to include a dummy for each district (dropping one reference district).
  • This is called the LSDV approach.
  • It gives the same slope coefficients as the within estimator when the specification matches.

LSDV in statsmodels

Comparing Pooled and FE Estimates

What FE Cannot Estimate

  • Any regressor that is perfectly time-invariant within district is swept out by demeaning.
  • Example: a constant coastal-district dummy cannot be identified in FE.
  • FE is excellent for removing time-constant omitted factors, but it cannot recover the effect of variables that do not change over time within units.

Kerala District Interpretation

If better soil districts also use more fertilizer, pooled OLS may exaggerate the fertilizer effect.

FE removes the fixed district component, so the coefficient is identified only from within-district year-to-year changes.

Checking the Demeaned Means

Exercise

Use manual demeaning to estimate a fixed-effects model. Then estimate the same model with district dummies. Are the fertilizer and rainfall slopes close? Why should they be?

Summary

  • ✅ Fixed effects remove time-invariant omitted variables by comparing each unit to itself over time.
  • ✅ The within estimator uses demeaned variables; LSDV uses unit dummies.
  • ✅ FE is appropriate when unobserved unit effects are correlated with regressors.
  • ✅ Time-invariant regressors cannot be estimated in a standard FE model.

Next Lecture

  • We study random effects and the Hausman test.
  • You will see when a random-effects assumption is plausible and how to compare FE with RE.
  • We implement the fixed-effects logic manually using standard numpy and statsmodels.