我的数据如下:
prfs
ex F M
Pref
C 11 20
B 15 6
A 3 5我想做一个精确的费舍尔测试。在2x2中有一个函数,但只接受2x2应急表:
stats.fisher_exact(prfs, alternative = 'two-sided')
ValueError: The input `table` must be of shape (2, 2).在R中,有一个函数可以做到这一点,但是在Python中呢?在R:
fisher.test(prfs)
Fisher's Exact Test for Count Data
data: prfs
p-value = 0.03261
alternative hypothesis: two.sided发布于 2018-11-05 20:13:38
scipy.stats.chi2_contingency()是您将得到的最接近的。
https://stackoverflow.com/questions/53161328
复制相似问题