Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

PanelOLS and Variance Decomposition

$
0
0

Maybe this question is trivial for some but I would need some hints on how to execute a variance decomposition for a PanelOLS model. Consider the following regression :

\text{Target}{ijt} = \alpha + \beta X{ijt-1} + \eta_{i} + \nu_{jt} + \epsilon_{it}

Where $\eta$ and $\nu$ are fixed effects.

I've tried to get Partial SS from anova_lm (sm.stats) but without results since I don't think the two packages (vs linearmodels) work together.

If anyone has some kind of ideas to go trough this, would be really helpfull! Thanks

I've also tried to compute the PanelOLS model one variable at a time, save the total_ss and compare it the the full model but somehow always obtain the same value for each model.

`# Fit the full modelfull_model = PanelOLS(df['target'],                    exog = sm.add_constant(df[setup_decomp_book[0]['vars']]),                    time_effects = True,                    entity_effects = False) \                        .fit()# Calculate the total ssfm_total_ss = full_model.total_ssreduce_tt_ss = {}for var in setup_decomp_book[0]['vars'] :    reduced_model = PanelOLS(df['target'],                    exog = sm.add_constant(df[var]),                    time_effects = True,                    entity_effects = False) \                        .fit()    # save the individuals ss    reduce_tt_ss[var] = reduced_model.total_ss`

Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>