[Rd] prop.test confidence intervals (PR#2794)
tlumley at u.washington.edu
Fri Apr 18 12:53:40 MEST 2003
On Fri, 18 Apr 2003 rbaer at kcom.edu wrote:
> Full_Name: Robert W. Baer, Ph.D.
> Version: 1.6.2
> OS: Windows 2000
> Submission from: (NULL) (18.104.22.168)
> Problem: prop.test() does not seem to produce appropriate confidence intervals
> for the case where the vector length of x and n is one. (I am not certain about
> higher vector lengths.)
> As an example, I include x=6 and n=42 which has a mean proportion of 0.115.
> 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.
No, it isn't a bug. It uses a Normal approximation, but not the one you
were using. It is based on inverting the score test rather than the Wald
test, and is substantially more accurate.
Checking by simulation: n=42, p=0.1, 10,000 replicates, the coverage from
prop.test without correction was 96.7%, with correction was 97.9% and from
the Wald-based Normal approximation was 92.3%.
More information about the R-devel