prop.test confidence intervals (PR#2794)
rbaer@kcom.edu writes:
As an example, I include x=6 and n=42 which has a mean proportion of 0.115.
...n=52...
When I calculate the 95% CI using the normal approximation by hand (and no continuity correction) I get (0.028, 0.202). The exact binomial CI from binom.test() is (0.044, 0.234). With correct=FALSE prop.test produces CI95 = (0.05396969, 0.22971664) which is neither of these. With correct=TRUE it produces (0.04778925, 0.2412937) This seems reasonably like a normal approximation 95% CI (which I presume is what is used by prop.test()) of the true binomial but I did not actually check it by hand. BUG summary. The prop.test() calculation of 95% CI of sample proportions is improperly calculated when continuity correction is turned off.
Uhm... Basically, we know the correct answer from binom.test, and R's intervals are considerably closer to that than the textbook p+-2*se(p) formula. So R has a bug because it isn't inaccurate enough?? This might enlighten you: prop.test(6,52,p=.05396969,alt="g",correct=F) prop.test(6,52,p=.22971664,alt="l",correct=F) also, consider the case x=0.
O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907