Why Dummy-Variable Collinearity Matters
A least-squares-dummy-variable (LSDV) regression represents fixed effects by including indicator variables in an ordinary least-squares model. The representation is flexible, but a careless choice of indicators can make the design matrix rank deficient: some coefficients cannot be uniquely estimated because one or more columns are exact linear combinations of others. The fitted values may still be well defined, but the individual coefficients are not.
The usual remedy is a normalization: include an intercept and omit a reference indicator, or include a complete set of indicators and omit the intercept. In a two-way model, entity and time indicators require coordinated coding. These choices change how the intercept and fixed effects are reported, not the fitted values of an otherwise unchanged model.
A set of columns is linearly dependent if some nonzero set of weights makes their weighted sum the zero column. Equivalently, a regressor is redundant if it can be written as a linear combination of the other regressors. In that case, the least-squares objective can determine fitted values without determining a unique coefficient vector.
One-Way Entity Effects: Intercept or Complete Indicators
Suppose there are \(N\) observed entities, and each observation belongs to exactly one of them. Let \(D_{it}=1\) when an observation belongs to entity \(i\), and \(0\) otherwise. For every observation, exactly one entity indicator equals one. Therefore, the column of ones is the sum of all \(N\) entity-indicator columns:
Consequently, an intercept plus all \(N\) entity indicators is exactly collinear. One standard specification includes an intercept and \(N-1\) entity indicators, treating the omitted entity as the reference. Another includes all \(N\) entity indicators but no intercept. Both can represent any set of entity-specific intercepts.
This equivalence follows by reparameterizing the entity intercepts. If the desired entity-specific levels are \(c_1,\ldots,c_N\), choose entity \(r\) as the reference. Set the intercept to \(c_r\) and each included indicator coefficient to \(c_i-c_r\), for \(i\ne r\). The predicted level for the reference is \(c_r\); for entity \(i\), it is \(c_r+(c_i-c_r)=c_i\). Thus, reference coding does not constrain the entity-specific fitted levels.
Worked Example: Choosing a Reference Entity
Consider the following hypothetical panel observations. The outcome \(y\) is measured in units, and \(x\) is measured in units of a covariate.
| Entity | Period | \(x\) | \(y\) |
|---|---|---|---|
| A | 1 | 0 | 2 |
| A | 2 | 1 | 4 |
| B | 1 | 1 | 5 |
| B | 2 | 2 | 7 |
| C | 1 | 2 | 4 |
| C | 2 | 3 | 6 |
Within each entity, \(x\) increases by \(1\) and \(y\) increases by \(2\). The within-entity slope is therefore \(\hat\beta=2/1=2\). The fitted entity levels are \(\bar y_i-\hat\beta\bar x_i\). For A this is \(3-2(0.5)=2\); for B it is \(6-2(1.5)=3\); and for C it is \(5-2(2.5)=0\).
With A as the reference, the fitted model is \(\hat y=2+2x+1D_B-2D_C\). Its entity-specific levels are \(2\) for A, \(2+1=3\) for B, and \(2-2=0\) for C. Alternatively, with no intercept and all three entity indicators, the coefficients on \(D_A,D_B,D_C\) are \(2,3,0\), respectively, alongside the same slope of \(2\).
If an intercept and all three entity indicators are included, their columns satisfy \(\mathbf{1}=\mathbf{D}_A+\mathbf{D}_B+\mathbf{D}_C\). The coefficients are then not unique: adding any constant \(k\) to the intercept and subtracting \(k\) from every entity coefficient leaves every fitted value unchanged. For example, the entity levels can be represented by intercept \(2\) and dummy coefficients \(0,1,-2\), or by intercept \(0\) and coefficients \(2,3,0\).
Two-Way Effects: Coordinate the Entity and Time Indicators
A two-way fixed-effects specification includes entity effects and time effects. If it also has an intercept, including every entity indicator and every time indicator creates exact dependencies. The intercept equals the sum of all entity indicators and also equals the sum of all time indicators, because each observation belongs to exactly one entity and one period. A common full-rank coding is an intercept, \(N-1\) entity indicators, and \(T-1\) time indicators, with one reference entity and one reference period.
When the observed entity-period pattern is connected, these reference-category columns span the same additive entity-and-time fitted values as the complete indicators. Connected here means that the observed entity-period links join the entities and periods into one component. In the usual complete panel this condition holds. If the pattern is disconnected, further dependencies can arise; do not assume the usual reference coding guarantees full rank without checking the observed design.
Worked Example: Coding Entity and Time Effects Together
Suppose hypothetical outcomes in a complete two-entity, two-period panel are \(y_{A1}=10\), \(y_{A2}=12\), \(y_{B1}=13\), and \(y_{B2}=15\). These values have an additive representation with A and period 1 as references:
The four fitted values are \(10\) for A in period 1, \(10+2=12\) for A in period 2, \(10+3=13\) for B in period 1, and \(10+3+2=15\) for B in period 2. Thus the intercept is 10, the B effect relative to A is 3 outcome units, and the period-2 effect relative to period 1 is 2 outcome units.
Now define indicators \(D_A,D_B,T_1,T_2\) for both entities and both periods. Row by row, \(1=D_A+D_B=T_1+T_2\). With an intercept, all four indicators are redundant in combination: the intercept column can be formed from the two entity columns or from the two time columns. The reference-coded specification avoids this problem by omitting \(D_A\) and \(T_1\). If instead all four indicators are used without an intercept, there is still a dependency, \(D_A+D_B=T_1+T_2\), so one additional normalization is needed.
The chosen reference categories affect coefficient interpretation. In the example, changing the reference entity or period changes the reported intercept and relative effects, but not the four fitted values. The intercept is the fitted outcome for the reference entity in the reference period when any other included regressors are set to zero. If that zero is not substantively meaningful, the intercept may have little direct interpretation; the model can still provide meaningful fitted comparisons.
Finding Other Redundant Effects
The dummy-variable trap is not limited to a complete set of entity or time indicators. Any included indicator that is already represented by other columns is redundant. For example, a post-period indicator defined as one in periods 2 and 3 is the sum of the period-2 and period-3 indicators when period 1 is the time reference. Likewise, a group label that never changes within an entity can be represented by the entity indicators. It cannot have a separate coefficient alongside unrestricted entity effects.
Worked Example: Detecting a Redundant Post Indicator
In a hypothetical three-period panel, use period 1 as the reference and include indicators \(T_2\) and \(T_3\). Define \(Post=0\) in period 1 and \(Post=1\) in periods 2 and 3. For observations in the three periods, the indicator values are:
| Period | Intercept | \(T_2\) | \(T_3\) | \(Post\) |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 |
| 2 | 1 | 1 | 0 | 1 |
| 3 | 1 | 0 | 1 | 1 |
The columns satisfy \(Post=T_2+T_3\): in period 1, \(0=0+0\); in period 2, \(1=1+0\); and in period 3, \(1=0+1\). Therefore, a model with an intercept, both time indicators, and \(Post\) cannot estimate all three time-related coefficients uniquely. If the purpose is to control flexibly for each period, omit \(Post\); its information is already contained in the time indicators. If the purpose instead requires a single post-period contrast, the model specification must be chosen to estimate that contrast rather than adding it to a complete set of time controls.
The same check applies to an entity-level group indicator. If entities A and C are in one group and B is in another, the first group's indicator equals \(D_A+D_C\) on every observation. With unrestricted entity indicators already in the regression, the group effect is redundant. This is a design-matrix fact, not evidence that the group has no association with the outcome.
A Practical Check and a Common Mistake
Before fitting an LSDV model, write down exactly which intercept and indicator columns it contains. For each observation, check whether the indicators partition the observations, and whether any proposed extra indicator is a sum or other linear combination of existing columns. Software may automatically drop a column, report an aliased coefficient, or use a generalized inverse; these behaviors can produce fitted values while concealing that some coefficients are not separately identified.
Common mistake: “I included all entity and time indicators, so the model controls for every category and software will estimate every coefficient.” The control set may span the desired fitted values, but spanning them does not make the coefficients unique. For example, in a one-way model with an intercept, \(\mathbf{1}=\sum_i\mathbf{D}_i\), so the intercept and all entity coefficients can be shifted against each other without changing predictions. The correction is to choose an explicit normalization—typically an intercept with one reference category omitted—or to use a no-intercept parameterization and verify that no other dependency remains.
Check Your Understanding
Answer these questions using the design-matrix relationships in the tutorial.
- Why are an intercept and all \(N\) entity indicators linearly dependent when every observation belongs to exactly one entity?
- With entity A as the reference, what does the coefficient on \(D_B\) represent in an entity fixed-effects regression?
- In a two-way model with an intercept, what reference-category coding avoids the usual redundancy among entity and time indicators?
- If \(Post=T_2+T_3\), what happens when \(Post\), \(T_2\), and \(T_3\) are all included in the same regression?
- Why does a group indicator that is constant within entity have no separately identified coefficient alongside unrestricted entity indicators?