TL;DR
Suppose you follow the same workers, firms or countries over several years. Each one has traits that never change, such as its location or its culture, and these traits can distort a simple comparison across units. A fixed effects model gives each unit its own constant term to absorb those traits. It then estimates the effect from changes within each unit over time, so anything fixed about the unit drops out.
Where you'll see it: in labour economics (does a training programme raise the wages of the same workers?), in policy evaluation across regions, and in any study that tracks the same units repeatedly.
Intuition
Compare each unit with itself
Imagine two cities. City A is rich and has a new tram line. City B is poor and has none. A simple comparison of the two cities mixes up the tram with everything else that makes A rich. A better question is: in each city, did the rate of jobs change after its own tram opened? Each city becomes its own control. Things that stay the same in a city, such as its geography, cannot explain a change inside that city.
That is the idea of fixed effects. Each unit gets its own baseline, its "fixed effect", and the regression only uses how the unit moves away from that baseline.
Why it exists
Ordinary regression on panel data (see Panel Data) pools all the observations together, as if every row came from one unit (a "pooled" regression). If a trait that is unobserved, such as a firm's management quality, is both high for some firms and related to the treatment, the estimate is contaminated. This is the omitted variable bias problem. A trait that is constant within each unit can be removed by subtracting each unit's own average, so the bias from that trait disappears.
The picture below shows the logic. Each unit has its own line, and the lines are shifted by the unit's fixed trait. The fixed effect model removes the shifts and keeps only the slope inside each unit.
flowchart LR A["Raw data: units differ in level and in slope"] --> B["Subtract each unit's own average"] B --> C["Only within-unit changes remain"] C --> D["Regress demeaned outcome on demeaned treatment"] D --> E["Slope = effect of treatment inside units"]
The math
Let index units (such as workers) and index periods (such as years). Let be the outcome, the treatment or regressor, and the remaining error. The fixed effects model is
Here is the fixed effect of unit : a constant that captures everything about the unit that does not change over time. The coefficient is the effect of a one-unit change in on , and it is the quantity we want.
Averaging over time within unit , with periods and , gives
Subtracting this from the original equation removes :
This is the within transformation. The estimator of is then the ordinary least-squares slope (the line that minimises the sum of squared vertical gaps, see Linear Regression) through the demeaned data:
What the assumption means
The estimator is consistent (it homes in on the true as the number of units grows) when the error is uncorrelated with the regressor within each unit, once the fixed effect is removed. Written in words: after accounting for each unit's own baseline, the treatment should not move with the unobserved shocks in the same period. This is weaker than assuming the unit traits are unrelated to the treatment, which is exactly what fixed effects is designed to allow.
What is lost
Any variable that never changes within a unit has . Its coefficient cannot be estimated, because it has been absorbed into . A worker's sex or a city's latitude cannot be estimated with unit fixed effects. The model only uses changes.
Worked examples
Take one unit observed twice, with and .
- Average within the unit: and .
- Demean: and .
- Slope through the origin: .
Interpretation: inside this unit, each extra unit of goes with an extra 2 units of . The intercept is absorbed and never needs to be estimated directly.
Two units, each observed at two dates. Unit A has , and unit B has . In both, the true effect is , with no noise. The data are:
- Unit A: , .
- Unit B: , .
Within-unit demeaning:
- Unit A: , , so and .
- Unit B: , , so and .
- Numerator: .
- Denominator: .
- .
Interpretation: the fixed effects estimator recovers the true effect exactly, even though the units have very different baselines.
Now compare with a pooled regression that ignores the units. Pooling gives and across all four points. The deviations of from 1.75 are and those of from 6 are . The cross-product sum is and the sum of squared deviations is , so . Unit B has both a higher baseline and higher , and pooling mixes that into the slope, giving 2.55 instead of 2. The fixed effects estimate removes this and returns 2.
A study follows 500 workers for 6 years. Some workers enrol in a training course in year 3. The outcome is log wages. Pooled regression shows that trained workers earn more. But trained workers may be more motivated, and motivation is a fixed trait that also raises wages.
With worker fixed effects, the model compares each worker's wage before and after the course. Suppose the estimate is . Read as a rough approximation for small changes, this says that completing the course is associated with about 4 percent higher wages for the same worker, after accounting for stable traits such as motivation.
Caveats: a pay rise that happened at the same time as enrolment would also be picked up, so the estimate is credible only if nothing else changed for the same workers in those years. The study cannot say anything about the effect of a fixed trait such as education completed before the panel began.
Tradeoffs and failure modes
| Situation | What goes wrong | Better choice |
|---|---|---|
| The key regressor barely changes within units | Little variation remains, so the estimate is imprecise | Longer panels, or a design with larger within-unit changes |
| You need the effect of a time-invariant trait | It is absorbed into the fixed effect and cannot be estimated | Random effects, which make a different assumption, or a between-unit comparison |
| Other shocks hit the same units at the same time | They are not removed by a unit constant | Add time effects (a constant for each year, shared by all units), or a difference-in-differences design (compare the change in treated units with the change in untreated units) |
| The treatment is caused by something that changes within units | The fixed effect does not solve a time-varying confounder (see Confounding Bias) | An [[instrumental-variables |
| Measurement error in | Demeaning can amplify the error in the changes | Careful measurement, or instruments |
A common trap is reading the fixed effects coefficient as a causal effect when the error is still correlated with a time-varying cause. Fixed effects is a strong tool, not a cure for all confounding. The Causal Inference question still has to be answered by the design.
Random effects is the usual alternative. It treats as a random draw and uses both within and between variation, so it is more efficient when its assumption holds. It fails when the unit traits are correlated with the regressors, which is exactly the case fixed effects was built for. Choosing between them is a question of which assumption you are more willing to defend.
History
The use of unit-specific constants in combined time-series and cross-section data came into econometrics in the 1950s and 1960s, as researchers began pooling data from many firms, households or countries. The within transformation, which subtracts each unit's average, is the computational heart of the method.
The relationship between fixed effects and random effects was set out more clearly in the 1970s and 1980s. Yair Mundlak's 1978 paper on pooling time-series and cross-section data showed that the two approaches can be written in one framework, which made the choice between them easier to reason about. Fixed effects became standard in applied economics through the 1990s and 2000s, especially for evaluating policies using repeated data on the same units.
Recap
- Each unit gets a constant that absorbs everything about it that does not change.
- Subtracting each unit's average (the within transformation) removes the constant and leaves only within-unit changes.
- The slope through those changes is the fixed effects estimate of , and it is protected from bias by fixed unit traits, though not from time-varying confounders.
This sets up other Panel Data methods, such as difference-in-differences, where the same comparison of units over time is combined with a policy change.
Check yourself
QuestionRecall: what does the fixed effect represent?Show answer
It is a constant for unit that captures everything about the unit that stays the same over time, such as its location or its underlying culture. Because it is constant, the model removes it by comparing each unit with its own average.
QuestionComputation: one unit has and . Find for this single unit.Show answer
Averages are and . Demeaned values are and . The numerator is . The denominator is . So .
QuestionWhy: explain why a pooled regression can give a different slope from the fixed effects estimate when units have different baselines.Show answer
Pooling treats all observations as if they shared one baseline. If units with higher baselines also have higher values of , the pooled slope picks up that difference between units, not just the effect of within a unit. Fixed effects removes the baseline differences, so only within-unit changes drive the slope.
QuestionApplied: a study estimates a fixed effects coefficient on a worker's education level, which does not change over the panel. What happens?Show answer
The coefficient cannot be estimated. Education is constant within each worker, so its demeaned value is zero for every observation. It is absorbed into the worker's fixed effect. To study education, the analyst needs a different design, such as a between-worker comparison or a random effects model, each with its own assumptions.