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

cberry at tajo.ucsd.edu cberry at tajo.ucsd.edu
Wed Sep 3 19:57:34 MEST 2003


On Sat, 30 Aug 2003, Kurt Hornik wrote:
[deleted]
> 
> I changed the code (r-devel) to
> 
>         CINT <- switch(alternative,
>                        less = c(0, ncp.U(x, 1 - conf.level)),
>                        greater = c(ncp.L(x, 1 - conf.level), Inf),
>                        two.sided = {
>                            if(ESTIMATE == 0)
>                                c(0, ncp.U(x, 1 - conf.level))
>                            else if(ESTIMATE == Inf)
>                                c(ncp.L(x, 1 - conf.level), Inf)
>                            else {
>                                alpha <- (1 - conf.level) / 2
>                                c(ncp.L(x, alpha), ncp.U(x, alpha))
>                            }
>                        })
> 

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))
                            }

> which seems to fix the problem.
> 
> Thanks,
> 
> -k
> ______________________________________________
> R-devel at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-devel
> 

Charles C. Berry                        (858) 534-2098 
                                         Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu	         UC San Diego
http://hacuna.ucsd.edu/members/ccb.html  La Jolla, San Diego 92093-0717



More information about the R-devel mailing list