# [R] prop.test CI depends on null hypothesis?

Aaron Rendahl rend0020 @end|ng |rom umn@edu
Mon Oct 21 18:33:58 CEST 2019

```Why does prop.test use continuity correction "only if it does not exceed
the difference between sample and null proportions in absolute value"?  I'm
referring here to the single group method, though I believe there is a
similar issue with the two group method.

What this means in practice is that the confidence interval changes
depending on the null hypothesis; see examples below. This is unexpected,
and I have been unable to find any documentation explaining why this is

## when the null proportion is equal to the sample proportion, it does not
## use the continuity correction, even when one is asked for

> prop.test(30,60,p=0.5, correct=TRUE)

1-sample proportions test without continuity correction

data:  30 out of 60, 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.3773502 0.6226498
sample estimates:
p
0.5

## however, when the null proportion is not equal to the sample proportion,
## it does use the continuity correction when it is asked for.

> prop.test(30,60,p=0.499, correct=TRUE)

1-sample proportions test with continuity correction

data:  30 out of 60, null probability 0.499
X-squared = 0, df = 1, p-value = 1
alternative hypothesis: true p is not equal to 0.499
95 percent confidence interval:
0.3764106 0.6235894
sample estimates:
p
0.5

The documentation refers to Newcombe's 1998 Statistics in Medicine article;
I read through this and found nothing about not using the continuity
correction in this situation.
https://doi.org/10.1002/(SICI)1097-0258(19980430)17:8%3C857::AID-SIM777%3E3.0.CO;2-E

On this mailing list, there was a 2013 post "prop.test correct true and
false gives same answer", which was answered only with the quote from the
help page: https://stat.ethz.ch/pipermail/r-help/2013-March/350386.html

I also found several questions asking which Newcombe method is implemented,
which didn't elicit specific answers; here's one from 2011:
https://stat.ethz.ch/pipermail/r-help/2011-April/274086.html

--
Aaron Rendahl, Ph.D.
Assistant Professor of Statistics and Informatics
College of Veterinary Medicine, University of Minnesota
295L AS/VM, 612-301-2161

[[alternative HTML version deleted]]

```