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 > ______________________________________________ > [EMAIL PROTECTED] 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:[EMAIL PROTECTED] UC San Diego http://hacuna.ucsd.edu/members/ccb.html La Jolla, San Diego 92093-0717 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-devel