BUG: GEE subclasses NominalGEE don't work with pandas exog #1931

josef-pkt opened this Issue Aug 22, 2014 · 1 comment


None yet

1 participant


using pandas.DataFrame for endog and exog raises and exception in __init__ setup_nominal

ERROR: statsmodels.genmod.tests.test_gee.TestGEEMultinomialCovType.test_wrapper
Traceback (most recent call last):
  File "c:\programs\python27\lib\site-packages\nose-1.0.0-py2.7.egg\nose\case.py", line 187, in runTest
  File "E:\Josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new2_py27\statsmodels\statsmodels\genmod\tests\test_gee.py", line 968, in test_wrapper
  File "E:\Josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new2_py27\statsmodels\statsmodels\genmod\generalized_estimating_equations.py", line 1692, in __init__
    exog, groups, time, offset)
  File "E:\Josef\eclipsegworkspace\statsmodels-git\statsmodels-all-new2_py27\statsmodels\statsmodels\genmod\generalized_estimating_equations.py", line 1742, in setup_nominal
    exog_out[jrow, :] = np.kron(u, exog_row)
ValueError: operands could not be broadcast together with shapes (4) (2)

I'm in the middle of adding the wrappers and this is a test failure, but it looks unrelated to the wrappers.
I haven't tested outside of my branch. PR #1916

Both, OrdinalGEE and NominalGEE, call setup_xxx before doing the super call. The data is preprocessed, but there is no asarray in there.

OrdinalGEE has a set of `asarray in there and works without problems with pandas DataFrames

I don't know whether from_formula works, no test case, and I haven't tried an example yet.


Ok, copying the asarray from OrdinalGEE to NominalGEE fixes it.

@josef-pkt josef-pkt changed the title from BUG: GEE subclasses OrdinalGEE, NominalGEE don't work with pandas exog to BUG: GEE subclasses NominalGEE don't work with pandas exog Aug 22, 2014
@josef-pkt josef-pkt closed this in 3062a80 Aug 23, 2014
@bert9bert bert9bert added a commit to bert9bert/statsmodels that referenced this issue Aug 29, 2014
@josef-pkt @bert9bert josef-pkt + bert9bert BUG: NominalGEE fix initialization for pandas, closes #1931 83bb8c1
@yarikoptic yarikoptic added a commit to yarikoptic/statsmodels that referenced this issue Oct 23, 2014
@yarikoptic yarikoptic Merge commit 'v0.5.0-1269-g957a43e' into debian-experimental
* commit 'v0.5.0-1269-g957a43e': (59 commits)
  TST: avoid pandas in assert with wrapped results (failure pandas>0.12)
  REF: GEEResults rename to postfix names, keep old as alias for now
  BUG: NominalGEE pandas handling, fix typo, adjust unit tests
  ENH: GEE add Wrapper, closes #1904
  BUG: NominalGEE fix initialization for pandas, closes #1931
  BUG/ENH: add df_resid, df_model, fixes t_test, closes #1918
  REF: GEE rename naive_covariance -> cov_naive, same for others
  REF: rename covariance_type -> cov_type
  TST: test_glm: remove test noise
  BUG: GEE subclasses cov_params_default doesn't get attached, unit tests
  REF: GEE summary remove covariance_type argument (not possible)
  BUG/TST: GEE fix predict closes #1919 and fix conf_int for cov_params_default add GEE to generic test, and adjust those (missing _results, summary2)
  BUG: GEE partial cleanup of cov_type, see #1906
  ENH: cov_kwds add generic 'scaling_factor' option to match Stata
  BUG: genmod links, CDFLink, probit deriv2 use approx_fprime (not complex)
  BUG: fix used hessian in sandwich_covariance, with GLM test cases
  REF: GLM change default scale in score_obs (tests pass, possibly wrong, see PR comment)
  REF/TST generic cov_type, TST compare GLM Logit, GLM OLS (this fails)
  REF/ENH: add get_robustcov_results generically to LikelihoodModel/Results    NegativeBinomial as test case, needs cleanup for code duplication.
  ENH: add cov_type to GLM.fit, with tests for family Poisson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment