You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Error in accessing mixedlm results with random slopes #2099
Per the email thread on the support page, I'm opening an issue describing an error accessing MixedLM results.
import pandas as pd
import statsmodels.api as sm
import statsmodels.formula.api as smf
data = sm.datasets.get_rdataset('dietox', 'geepack').data
mod = smf.mixedlm('Weight ~ Time', data, groups = 'Pig')
modf = mod.fit()
print modf.summary()
When I try to include a random slope, the model runs and gets fitted:
mod = smf.mixedlm('Weight ~ Time', data, groups = 'Pig', re_formula = '~Time')
modf = mod.fit()
but I get the following error:
print modf.summary()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/statsmodels/regression/mixed_linear_model.py", line 1954, in summary
sdf = pd.DataFrame(index=self.model.data.param_names, data=sdf)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.0_14_g8e0155c-py2.7-macosx-10.9x86_64.egg/pandas/core/frame.py", line 238, in __init__
copy=copy)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.0_14_g8e0155c-py2.7-macosx-10.9-x86_64.egg/pandas/core/frame.py", line 371, in _init_ndarray
return create_block_manager_from_blocks([values.T], [columns, index])
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.0_14_g8e0155c-py2.7-macosx-10.9-x86_64.egg/pandas/core/internals.py", line 3489, in create_block_manager_from_blocks
construction_error(tot_items, blocks[0].shape[1:], axes, e)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.15.0_14_g8e0155c-py2.7-macosx-10.9-x86_64.egg/pandas/core/internals.py", line 3470, in construction_error
passed,implied))
ValueError: Shape of passed values is (6, 5), indices imply (6, 4)
Activity
jseabold commentedon Nov 19, 2014
Will be closed by #2097
Backport PR #2097: BUG: Make sure RE names are properly handled in Mi…