Fixed-Effects Lab (Unit and Two-Way FE)

Explore why pooled OLS can be biased when regressors are correlated with unobserved unit or time factors. Compare pooled OLS, unit fixed-effects, and two-way FE estimates on a simulated panel where you control endogeneity and time trends.

Parameters

Higher ρ = stronger endogeneity if you ignore unit FE.

40
8

Quick scenarios

Estimates

Pooled OLS (no FE)
1.733
Bias vs β: 0.533
Unit Fixed Effects
1.524
Bias vs β: 0.324
Two-Way FE (unit + time)
1.125
Bias vs β: -0.075

When ρ>0, pooled OLS is biased because x is correlated with unit FE αi. The FE estimators remove these unobservables by demeaning. Two-way FE also removes common time shocks/trends γt.

Panel at a glance

01234567Time (t)Mean outcome ȳ_tAverage outcome over time (for the simulated panel)

The average outcome rises with time when a deterministic trend is present in γt. Two-way FE accounts for these common shocks.

Stata implementation

What’s next?

Try Instrumental Variables to handle endogeneity when FE is not enough, or head back to DiD for policy evaluation.