Python wilcoxon: unequal N

瘦欲@ 提交于 2019-12-23 10:15:41

问题


Rs wilcox.test can take different length vectors, but the wilcoxon from scipy.stats cannot: I get an unequal N error message.

from scipy.stats import wilcoxon
wilcoxon(range(10), range(12))

Is there a way to get Rs behavior in Python?


回答1:


According to the R docs:

Performs one- and two-sample Wilcoxon tests on vectors of data; the latter is also known as ‘Mann-Whitney’ test.

So just use

from scipy.stats import mannwhitneyu
mannwhitneyu(range(10), range(12))
# (50.0, 0.26494055917435472)


来源:https://stackoverflow.com/questions/33890367/python-wilcoxon-unequal-n

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!