mnlogit with float dependent variable

时间:2017-10-01 15:42:40

标签: python statsmodels

我想估计一下形式的多项式:

'L2 ~ C(v)'

并运行

import statsmodels.formula.api as smf
res = smf.mnlogit('L2 ~ C(v)', data=test[test.v == 0.2]).fit()

我得到了

Optimization terminated successfully.
         Current function value: 1.036628
         Iterations 5

但是当我想要打印结果时,我看到了

print(res.summary())
Traceback (most recent call last):
  File "/home/x/anaconda3/envs/myenv3/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 2847, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-45-5240cd5460e8>", line 1, in <module>
    asd.summary()
  File "/home/x/anaconda3/envs/myenv3/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py", line 2559, in summary
    yname, yname_list = self._get_endog_name(yname, yname_list)
  File "/home/x/anaconda3/envs/myenv3/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py", line 2945, in _get_endog_name
    ynames = ['='.join([yname, name]) for name in ynames]
  File "/home/x/anaconda3/envs/myenv3/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py", line 2945, in <listcomp>
    ynames = ['='.join([yname, name]) for name in ynames]
TypeError: sequence item 1: expected str instance, numpy.float64 found

我的测试数据(pandas数据框)有一个x和两个y值,所以我希望固定效应回归给我一个概率{{1} 4/19的{​​{1}}和y==0.152577的{​​{1}}:

15/19

为什么我看到错误?我在statsmodels y==0.341053

0 个答案:

没有答案