私のデータは次のとおりです。
prfs
ex F M
Pref
C 11 20
B 15 6
A 3 5
正確なフィッシャー検定を行いたいと思います。scipy には関数がありますが、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