Statistics Glossary → Two-way fixed effects (TWFE)
Two-way fixed effects (TWFE)concept
A regression model for panel data that controls, through unit and time fixed effects, both for each unit's time-invariant characteristics and for period shocks that affect all units at once.
The model is y_it = α_i + λ_t + β·D_it + ε_it: α_i is the fixed effect of each unit (person, city, firm) and λ_t the common effect of each period. Unit effects absorb all time-invariant confounders, even unobserved ones; time effects absorb shocks common to everyone, such as an economic crisis or the season. β is therefore estimated from changes within units. In difference-in-differences designs, TWFE is used as the multi-period, multi-group generalization of the classic 2×2 comparison; its event-study version estimates the effect of each period relative to treatment separately.
TWFE cannot control for time-varying confounders that affect both treatment and outcome, and it rests on the parallel-trends assumption. When treatment starts at different times for different units (staggered adoption) and the effect varies over time or across units, the TWFE estimate can use already-treated units as controls and yield an average of effects with negative weights. New estimators such as Callaway-Sant'Anna or Sun-Abraham have been proposed for this problem. In an event study, pre-treatment coefficients close to zero support, but do not prove, the parallel-trends assumption.
An everyday example
Several cities raise the minimum wage in different years, and a researcher wants to know the effect on employment. City fixed effects remove permanent differences, such as large cities always having more jobs; year fixed effects remove a recession that hits the whole country. What remains is a comparison of each city's change before and after its increase with the change in cities that did not raise the wage.
In MerQur
In Difference-in-Differences, the 'Model' parameter chooses between Classic 2×2, Two-way fixed effects (TWFE) and Event study (TWFE). It is also used as unit and time fixed effects in Panel Data Regression.
Analyses where this concept appears
Panel Data RegressionDifference-in-Differences (DiD)