brentp / fishers_exact_test

Fishers Exact Test for Python (Cython)
BSD 3-Clause "New" or "Revised" License
64 stars 21 forks source link

two-tailed pvalue wrong results. #27

Open naman-nference opened 5 years ago

naman-nference commented 5 years ago

Similar issue: https://github.com/brentp/fishers_exact_test/issues/1 To fix this issue i can see that epsilon's value was set to 1e-40. https://github.com/brentp/fishers_exact_test/commit/784b16c13f93dc7f9501e75709bfcec28e981e81#diff-9d732e6f8ea16a3f2d3c25496385d6feL139

But in current release I can see epsilon value is 1e-6. Because of this two-tailed is giving wrong result. Current code: https://github.com/brentp/fishers_exact_test/blob/master/src/cfisher.pyx#L98

For my use case I want epsilon to be 1e-80. It would be better if epsilon cloud a function argument.

Kimxbzheng commented 4 years ago

I encountered the same issue. In R,

r = fisher.test(matrix(c(22, 0, 0, 102), nrow = 2)) r$p.value [1] 7.175067e-25

But pvalue_npy return 7.36841974e-11.