linearmodels/effects-outside-panel-ols
| Pack | Severity | Fix | Versions |
|---|---|---|---|
| linearmodels | error | none, edit by hand | All versions |
In linearmodels, only PanelOLS reads effect terms in a formula, and the other panel models drop them without an error. Use PanelOLS when you want fixed effects.
model = RandomEffects.from_formula("lwage ~ 1 + hours + EntityEffects", data)model = PanelOLS.from_formula("lwage ~ 1 + hours + EntityEffects", data)What the rule reports
Section titled “What the rule reports”The rule reports EntityEffects, FixedEffects or TimeEffects in a formula given to
PooledOLS, RandomEffects, BetweenOLS, FirstDifferenceOLS or FamaMacBeth. Every panel
model takes the three terms out of the formula, and only PanelOLS then uses them.
How to fix it
Section titled “How to fix it”xpd has no automatic fix, so make the change by hand.
On 7.1 and 7.0, each of the five classes returned the same coefficients for "lwage ~ 1 + hours" with and without each of the three terms, and raised no error and no warning. The reader of the formula sees fixed effects that the model does not have.
Diagnostic message
Section titled “Diagnostic message”In linearmodels, only PanelOLS reads EntityEffects, FixedEffects and TimeEffects in a formula, and this model drops the term in $F without an error. On the wage panel PooledOLS, RandomEffects, BetweenOLS, FamaMacBeth and FirstDifferenceOLS each returned the same coefficients with the term as without it. Use PanelOLS.from_formula for the effects, or take the term out.See all rules in the linearmodels pack.