【发布时间】:2019-01-21 06:18:08
【问题描述】:
我花了几个小时试图让 statsmodels 做我的 MANOVA,但没有成功。 代码如下:
from statsmodels.multivariate.manova import MANOVA
df = data
feats_list = ['col1', 'col2', 'col3' ... 'col4']
var_list = ['col5', 'col6']
endog, exog = np.asarray(df[feats_list]), np.asarray(df[var_list])
manov = MANOVA(endog, exog)
manov.mv_test()
提供:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-16-c3fc1d1f16f6> in <module>()
1 manov = MANOVA(endog, exog)
----> 2 manov.mv_test()
~\Anaconda3\lib\site-packages\statsmodels\multivariate\manova.py in mv_test(self, hypotheses)
68 name = 'x%d' % (i)
69 L = np.zeros([1, self.exog.shape[1]])
---> 70 L[i] = 1
71 hypotheses.append([name, L, None])
72
IndexError: index 1 is out of bounds for axis 0 with size
1
我也尝试自己提出假设,但我总是得到 SingularMatrixError,所以我想我没有正确使用该类。
提前感谢您的帮助。
【问题讨论】:
-
感谢您的回答,但似乎不是问题...
-
(我删除了我之前不正确的评论)这看起来像一个错误。 L 或 L[i] 看起来不对。看起来没有使用公式的情况下没有单元测试。
标签: python statsmodels manova