Skip to content
Prev 10433 / 63424 Next

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

On Sat, 30 Aug 2003, Kurt Hornik wrote:
[deleted]
I believe that the resulting interval will sometimes fail to satisfy the
confidence statement for values of alpha other than 0 or Inf.

('sometimes' rather than always, because of the discreteness of the
distribution)

I think you need 

 if(ESTIMATE == 0)
                                c(0, ncp.U(x, 1 - conf.level / 2))
                            else if(ESTIMATE == Inf)
                                c(ncp.L(x, 1 - conf.level / 2 ), Inf)
                            else {
                                alpha <- (1 - conf.level) / 2
                                c(ncp.L(x, alpha), ncp.U(x, alpha))
                            }
Charles C. Berry                        (858) 534-2098 
                                         Dept of Family/Preventive Medicine
E mailto:cberry@tajo.ucsd.edu	         UC San Diego
http://hacuna.ucsd.edu/members/ccb.html  La Jolla, San Diego 92093-0717