0

My data is the following:

prfs
ex  F   M
Pref        
C   11  20
B   15  6
A   3   5

I would like to make an exact Fisher test. There is a function in scipy but accepts only 2x2 contingency tables:

stats.fisher_exact(prfs, alternative = 'two-sided')
ValueError: The input `table` must be of shape (2, 2).

In R there is a function that does exactly that, but how about in Python? In R:

fisher.test(prfs)
Fisher's Exact Test for Count Data

data:  prfs
p-value = 0.03261
alternative hypothesis: two.sided
4

1 回答 1

1

scipy.stats.chi2_contingency() 是最接近的。

于 2018-11-05T20:13:38.987 回答