[R] Confidence interval calculation in prop.test
Douglas Bates
bates at stat.wisc.edu
Tue Oct 31 16:36:38 CET 2006
On 10/30/06, Richard Johnston <rmjohnston at mac.com> wrote:
> The confidence interval calculation in prop.test appears to be
> incorrect when alternative="greater". The upper limit is always set
> to 1.000. Am I missing something?
Like the t.test function the prop.test function returns a one-sided
interval when the alternative is "greater" or "less". The output
indicates that the 95% lower confidence bound on the proportion is
0.0369. If you choose alternative = "less" you will get a 95% upper
confidence bound (and the lower bound will always be given as 0).
Only when you use the default value, "two-sided", for the alternative
parameter will you get both the upper and lower bounds calculated.
> > total=c(250,250)
> > success=c(55,31)
> > prop.test(success,total,alternative="greater",correct=TRUE)
>
> 2-sample test for equality of proportions with continuity correction
>
> data: success out of total
> X-squared = 7.4289, df = 1, p-value = 0.003209
> alternative hypothesis: greater
> 95 percent confidence interval:
> 0.03693065 1.00000000
> sample estimates:
> prop 1 prop 2
> 0.220 0.124
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list