Within Estimator

Also known as · within estimator · fixed-effects within transformation

The within estimator is the algebraic equivalent of the Fixed Effects estimator. Instead of running OLS with unit dummies, it demeans each variable by subtracting the unit-specific mean: y~it=yit−yˉi\tilde y_{it} = y_{it} - \bar y_i, x~it=xit−xˉi\tilde x_{it} = x_{it} - \bar x_i, then runs OLS on the transformed data. The unit-fixed effect αi\alpha_i vanishes in the demeaning (it equals its own mean), leaving β^\hat\beta identified by within-unit variation only.

When to use

In practice you don't compute this by hand — feols(y ~ x | unit, data = df) (fixest) or plm(y ~ x, model = "within", data = df) (plm) do the within-transformation automatically and produce identical β^\hat\beta to OLS-with-dummies. The within form is faster on huge panels and clarifies the intuition: the coefficient comes from how each unit's own changes in xx relate to its own changes in yy.

Appears in