# Continuity correction in proportion test

Can you please clarify to me when to use continuity correction in proportion test please? I'm using this formula in R and I want to know the difference in the option correct= TRUE or FALSE. Also, I noticed the p value with correction goes up, so I'm just concerned if I'm using this option (TRUE or FALSE) correctly? how this might impacts my analysis. Any help is really appreciated!

prop.test(x=c(84,105.5),n=c(99,146),correct = TRUE)


Thank you

• How do you have half a success? Mar 18 at 2:04

In order to consider what you asked, without additional material, consider the $$2\times 2$$ table TAB as follows:

TAB = rbind(c(80,90), c(20,15))
TAB
[,1] [,2]
[1,]   80   90
[2,]   20   15


A chi-squared test of independence with the Yates correction is as follows:

chisq.test(TAB)

Pearson's Chi-squared test
with Yates' continuity correction

data:  TAB
X-squared = 0.81215, df = 1, p-value = 0.3675


In R, prop.test compares proportions $$80/100$$ and $$90/105.$$ A two-sided test is equivalent to the chi-squared test above--if the 'continuity correction' is used. Notice that the chi-squared statistic and the P-value are exactly the same. [The procedure prop.test gives more detail.]

prop.test(c(80,90), c(100,105), cor=T)

2-sample test for equality of proportions
with continuity correction

data:  c(80, 90) out of c(100, 105)
X-squared = 0.81215, df = 1, p-value = 0.3675
alternative hypothesis: two.sided
95 percent confidence interval:
-0.16998808  0.05570236
sample estimates:
prop 1    prop 2
0.8000000 0.8571429


For sufficiently large counts, Yates' correction is not needed. (And in my opinion too conservative.) If parameter cor=F is used to disable the correction, the chi-squared test is as follows:

chisq.test(TAB, cor=F)

Pearson's Chi-squared test

data:  TAB
X-squared = 1.1813, df = 1, p-value = 0.2771


Similarly, if cor=F is used, prop.test gives the same test statistic and P-value as just above.

prop.test(c(80,90), c(100,105), cor=F)

2-sample test for equality of proportions
without continuity correction

data:  c(80, 90) out of c(100, 105)
X-squared = 1.1813, df = 1, p-value = 0.2771
alternative hypothesis: two.sided
95 percent confidence interval:
-0.16022617  0.04594046
sample estimates:
prop 1    prop 2
0.8000000 0.8571429


Note: Simulated test statistics in case of expected counts below 5, and the use of Fisher's exact test are interesting topics, but have no direct connection with use or non-use of the Yates correction.

• Thank you for your detailed answer, its really appreciated. Can i do also fisher test and compare the results of the proportion test and the fisher test? all my data counts are above 5. Sorry if my question is dummy but I'm new to the statistics field. Many thanks for your help. Mar 17 at 8:38
• R will do an expanded version of Fisher's exact test for matrices larger than the traditional $2 \times 2.$ Traditionally, Fisher's test on $2 \times 2$ tables has been used in case expected counts are so small that the validity of the chi-squared P-value is in doubt. Fisher's traditional test uses a hypergeometric distribution. Often it agrees with the chi-squared test. But there has been controversy about what Fisher's test is really testing. Generally, it is best to do one test (unless the chi-squared test is in doubt). I prefer the simulation option in R for the chi-squared test. Mar 17 at 8:49
• @ BruceET, I'm very grateful for your help, helping people without knowing them is very appreciated. Many thanks for your nice clarification. Mar 17 at 8:54
• In private you may want to fuss with various tests. However, professionally I think it is best to have and consistently use a 'favorite test procedure. // Of course, it would be irresponsible to try various tests and report the one that is "significant" at the 5% level. Government approved protocols for clinical trials often require a decision in advance of taking data as to which tests will be used. Clinical trials seek to have enough subjects that small expected counts will not be an issue. Mar 17 at 8:56
• @ BruceET, I have so many significant results and I'm only afraid if it false positive that's why I want to be confident with what I got. I'm new to statistics world. thanks for guiding me. Mar 17 at 9:06

There are many opinions on how to best test for 2 x 2 contingency tables like this. Here the prop.test implements a chi-squared test. The issue is that in some cases data from a 2 x 2 contingency table isn't well approximated by the chi-squared distribution under the null. This can lead to p-values that are too small. Yates continuity correction adjusted for this but can lead to p-values that are too large.

There are other tests that you could use (Fisher's exact test being one) but another option in R is to simulate the distribution under the null and utilize this empirical distribution to calculate the p-value.

mat <- matrix(data = c(84, (99 - 84), 105.5, (146 - 105.5)), ncol = 2)

chisq.test(x = mat, correct = FALSE)

chisq.test(x = mat, correct = TRUE)

chisq.test(x = mat, simulate.p.value = TRUE)
`

Without the continuity correction, the p-value is 0.021. With the continuity correction, it's 0.031. Simulating the distribution produces a p-value of ~ 0.026. (One issue with this approach is that in R this simulation samples from a hypergeometric distribution which may not approximate your sampling situation.)

• Hi @num_39. Thank you so much for answering my question, its really appreciated. So I understand from your answer is that to check the correct p-value I should perform a stimulation test as you did for ever data that I have and consider the stimulated p-value as the correct one? Mar 17 at 7:49
• Also, if I use continuity correction this means that I'm avoiding false positive results? Mar 17 at 7:52
• I can't speak to your particular situation as I don't know any of the particulars, but yes using the continuity correction is less likely to produce false positives. I'd personally favor the simulation approach except for the fact that in R the simulations works with fixed row and columns sums, which may not be an appropriate assumption in your case. Mar 17 at 8:14