question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Remove fixed effects from summary_col

See original GitHub issue

(Following up from thread on mailing list: https://groups.google.com/forum/?hl=en#!topic/pystatsmodels/BnySoFBCcAE)

I’m estimating some simple OLS models that have dozens or hundreds of fixed effects terms, but I want to omit these estimates from the summary_col. Looking under the hood, it appears that the Summary object is just a DataFrame which means it should be possible to do some index slicing here to return the appropriate rows, but the Summary objects don’t support the basic DataFrame attributes and methods.

More formally:

import pandas as pd
import numpy as np
import string
import statsmodels.formula.api as smf
from statsmodels.iolib.summary2 import summary_col

df = pd.DataFrame({'A' : list(string.ascii_uppercase)*10,
                   'B' : list(string.ascii_lowercase)*10,
                   'C' : np.random.randn(260),
                   'D' : np.random.normal(size=260),
                   'E' : np.random.random_integers(0,10,260)})

m1 = smf.ols('E ~ D',data=df).fit()
m2 = smf.ols('E ~ D + C',data=df).fit()
m3 = smf.ols('E ~ D + C + B',data=df).fit()
m4 = smf.ols('E ~ D + C + B + A',data=df).fit()

print summary_col([m1,m2,m3,m4])

This returns a Summary object that has 55 rows (52 for the two fixed effects + the intercept + exogenous C and D terms). I would like a summary object that excludes the 52 fixed effects estimates and only includes the estimates for C, D, and the intercept for all four models. What’s the best way to remove fixed effects from the summary_col? Alternatively, how can I create a Summary object that only includes specific regressors and excludes the rest?

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
josef-pktcommented, Aug 14, 2018

This was fixed in #4064 after some PR detours in #1638 #3702

0reactions
brianckeegancommented, Apr 25, 2014

Submitted as PR 1638, but I haven’t tested.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Remove fixed effects from summary_col? - Google Groups
I would like a summary object that excludes the 52 fixed effects estimates and only includes the estimates for D, E, and the...
Read more >
Python: Do not show dummies in statsmodels summary
A quick and dirty way would be to first find those dummy indexes in the final summary_col and just avoid printing them:
Read more >
How to Remove Fixed Effects to Reduce Heterogeneity?
When discussing GMM estimation, Toni Whited and Luke Taylor suggest to reduce heterogeneity by ''eliminating fixed effects,'' see here on ...
Read more >
https://www.statsmodels.org/v0.12.2/_sources/relea...
The function :func:`~statsmodels.stats.meta_analysis.combine_effects` performs fixed effects and random effects analysis.
Read more >
Re: st: Omitting fixed effects dummies output from esttab tables
Re: st: Omitting fixed effects dummies output from esttab tables ... take a long time to delete each time I am formatting my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found