PanelOLS and Variance Decomposition

28 views Asked by At

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 model
full_model = PanelOLS(df['target'],
                    exog = sm.add_constant(df[setup_decomp_book[0]['vars']]),
                    time_effects = True,
                    entity_effects = False) \
                        .fit()

# Calculate the total ss
fm_total_ss = full_model.total_ss

reduce_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`
0

There are 0 answers