How to fix the Absorbing Effect Error when trying to include fixed effects in the PanelOLS function in Python's linearmodels?
Asked Answered
E

1

6

I am running a fixed effects panel regression use the PanelOLS() function in linearmodels 4.5.

While trying to add the 'entity_effects=True' and 'time_effects=True' in the model estimation, it returned 'AbsorbingEffectError':

The model cannot be estimated. The included effects have fully absorbed one or more of the variables. This occurs when one or more of the dependent variable is perfectly explained using the effects included in the model.

How can I fix the 'AbsorbingEffectError'?

panel = panel.set_index(['firm', 'Date'])  
exog_vars = panel[['ex_mkt', 'MV', 'ROA', 'BTM','leverage','2nd']]
exog = sm.add_constant(exog_vars)
y = panel[['ex_firm']]
model = PanelOLS(y, exog_vars,entity_effects=True).fit(cov_type='clustered', cluster_entity=True)

I am following the exact same steps as the example of the Fixed Effects model from the documentationhttps://bashtage.github.io/linearmodels/doc/panel/examples/examples.html#

Estevan answered 3/2, 2019 at 20:22 Comment(4)
did you find a solution? I'm having the same issueOrle
Unfortunately, nope, I switched to use Stata which can handle this issue.Estevan
Are you sure it does not raise an omitted variable error in the regression output? That's what happened to me with Stata. I did not have enough within variation in my data so that I had to drop the variable.Orle
Then that would due to your model specification, and you might need to revise your model settingEstevan
V
1

I think G.mc and TiTo have a good point and I had the same issue today. It appears that if you have a 'constant' variable (which means no variation), then this problem appears in python. I tried as well in stata, and it seems to work even though constants are included. By constant I mean the usual 'c' introduced in the analysis and any other variable which in fact is static over the time period.

Vertebrate answered 10/9, 2020 at 21:39 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.