brentp/fishers_exact_test — Issue #1: two-tailed pvalue wrong results
Author: i000
Created: 2012-02-20 19:54:41+00:00
State: open

Python:
fisher.pvalue(94, 48, 3577, 16988)
Pvalue(left_tail=1, right_tail=2.069e-37, two_tail=1.101e-10)

R:
> r = fisher.test(matrix(c(94, 48, 3577, 16988), nrow = 2))
> r$p.value
[1] 2.069356e-37

the reason is the very high epsilon:

cdef double epsilon = 1e-10
....
if p < cutoff + epsilon:
two_tail += p

so if cutoff < epsilon the two_tail is not even close