Skip to content
Prev 10406 / 63424 Next

fisher.test() gives wrong confidence interval (PR#4019)

jerome@hivnet.ubc.ca writes:
I don't think this is a bug, insofar as the problem is solvable at
all. The confidence interval consists of those x for which the test of
OR==x is not rejected at the 95% level. In the two sided case, you
need to count also the tables that differ in the "opposite direction",
and we unceremoniously assume that their probability is the same. 

For some small tables like this one the assumption is false since
there are only three tables consistent with the marginals. However,
this is not invariably the case, and trying to solve the test problem
exactly runs into the issue that the exact two-sided p-value for OR==x
is not a nice function of x (it has discontinuities and may be
non-monotone).

Consider this case, and you'll see part of the point
fisher.test(matrix(c(3,0,0,3),2),alt="g")