[R] prop.test correct true and false gives same answer
(Ted Harding)
Ted.Harding at wlandres.net
Wed Mar 27 22:21:43 CET 2013
On 27-Mar-2013 21:04:51 David Arnold wrote:
> All,
> How come both of these are the same. Both say "1-sample proportions
> test without continuity correction." I would suspect one would say
> "without" and one would say "with."
>
>
>> prop.test(118,236,.5,correct=FALSE,conf.level=0.95)
>
> 1-sample proportions test without continuity correction
>
> data: 118 out of 236, null probability 0.5
> X-squared = 0, df = 1, p-value = 1
> alternative hypothesis: true p is not equal to 0.5
> 95 percent confidence interval:
> 0.4367215 0.5632785
> sample estimates:
> p
> 0.5
>
>> prop.test(118,236,.5,correct=TRUE,conf.level=0.95)
>
> 1-sample proportions test without continuity correction
>
> data: 118 out of 236, null probability 0.5
> X-squared = 0, df = 1, p-value = 1
> alternative hypothesis: true p is not equal to 0.5
> 95 percent confidence interval:
> 0.4367215 0.5632785
> sample estimates:
> p
> 0.5
Note what is said (admittedly somewhat deeply tucked away)
under "Details" in ?prop.test:
"Continuity correction is used only if it does not exceed
the difference between sample and null proportions
in absolute value."
In your example, the sample proportion exactly matches the
null-hypothesis proportion (0.5).
Confirmation:
[A] Your same example:
prop.test(118,236,.5,correct=TRUE,conf.level=0.95)
# 1-sample proportions test without continuity correction
# data: 118 out of 236, null probability 0.5
# X-squared = 0, df = 1, p-value = 1
# alternative hypothesis: true p is not equal to 0.5
# 95 percent confidence interval:
# 0.4367215 0.5632785
# sample estimates:
# p
# 0.5
[B1] Slightly change x, but keep "correct=TRUE":
prop.test(117,236,.5,correct=TRUE,conf.level=0.95)
# 1-sample proportions test with continuity correction
# data: 117 out of 236, null probability 0.5
# X-squared = 0.0042, df = 1, p-value = 0.9481
# alternative hypothesis: true p is not equal to 0.5
# 95 percent confidence interval:
# 0.4304724 0.5611932
# sample estimates:
# p
# 0.4957627
[B2] Slightly change x, but now "correct=FALSE":
prop.test(117,236,.5,correct=FALSE,conf.level=0.95)
# 1-sample proportions test without continuity correction
# data: 117 out of 236, null probability 0.5
# X-squared = 0.0169, df = 1, p-value = 0.8964
# alternative hypothesis: true p is not equal to 0.5
# 95 percent confidence interval:
# 0.4325543 0.5591068
# sample estimates:
# p
# 0.4957627
So it doesn't do the requested continuity correction in [A] because
there is no need to. But in [B1] it makes a difference (compare
with [B2]), so it does it.
Hoping this helps,
Ted.
-------------------------------------------------
E-Mail: (Ted Harding) <Ted.Harding at wlandres.net>
Date: 27-Mar-2013 Time: 21:21:39
This message was sent by XFMail
More information about the R-help
mailing list