Skip to content

Bug fix for summary_col on summary2.py - #3324

Closed
KostasTok wants to merge 1 commit into
statsmodels:masterfrom
KostasTok:patch-1
Closed

KostasTok wants to merge 1 commit into
statsmodels:masterfrom
KostasTok:patch-1

Conversation

@KostasTok

Copy link
Copy Markdown

The following returns an error with the master code:

import statsmodels.formula.api as smf
import pandas as pd

ids = [1,1,1,1,1,2,2,2,2,3,3,3,3,3,3]
x = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]
y = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15]

d = {'Y':y,'X':x,'IDS':ids}
d = pd.DataFrame(d)

results1 = smf.mixedlm('Y ~ X', d, groups=d ['IDS']).fit()
results2 = smf.mixedlm('X ~ Y', d, groups=d ['IDS']).fit()
    
out = summary_col([results1,results2],stars=True)

This only appears with the results from mixedlm, as far as I can say. The fix, as proposed by @josef-pkt, returns the expected output. I have tried this with various other formulas and datasets and it appears to work.

@josef-pkt

Copy link
Copy Markdown
Member

unit tests on TravisCI fail in
AttributeError: 'MICEData' object has no attribute 'param_names'

I haven't looked yet where param_names should be defined. I assume the attribute is a "requirement".

@jbrockmendel

Copy link
Copy Markdown
Contributor

IIRC in the particular case of MICEResults the self.model doesn't actually subclass Model, so self.model.data may not behave as expected. Based on a quick look, best guess would have been self.exog_names or self.model.exog_names, but that is apparently the existing not-working version.

@josef-pkt

Copy link
Copy Markdown
Member

@KostasTok Thanks for the report and suggested fix.
fixed in #4505 which uses the fix proposed here but under try except protection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants