[R] pwr.prop.test and continuity correction

Peter Dalgaard p.dalgaard at biostat.ku.dk
Tue Dec 16 13:48:17 CET 2008


Daniel Brewer wrote:
> Hi,
> 
> I am trying to sort out a discrepancy between power calculations results
> between me and another statistician.  I use R but I am not sure what she
> uses.  It is on the proportions test and so I have been using
> pwr.prop.test.  I think I have tracked the problem down to pwr.prop.test
> not using the continuity correction for the test (I did this by using
> the java applet from
> http://stat.ethz.ch/R-manual/R-patched/library/stats/html/power.prop.test.html).
> 
> So I was wondering whether:
> 1) Someone could confirm that pwr.prop.test does not use a continuity
> correction in its calculation.
> 2) Someone could tell me either how to use pwr.prop.test or another
> function to get the power of a prop.test with continuity correction.
> The reason I want this is that I would normally apply the correction
> when I actually used the test.
> 
> Many thanks
> 
> Dan
> 

power.prop.test (sic) is relying heavily on asymptotic normality, as do 
similar formulas. It doesn't use continuity correction, but if you're 
working with such small group sizes, I suspect that the correction term 
is the least of your worries and that direct simulation would be better.

(Another source of discrepancy, sometimes seen in textbooks, is that 
authors use the null variance of p1-p2 also under the alternative. This 
simplifies the formulas considerably, but it does assume that the actual 
difference is rather small.)

R is Open Source. If you want a correction term, it is just a matter of 
figuring out where to modify expressions like

     p.body <- quote(pnorm(((sqrt(n) * abs(p1 - p2) -
         (qnorm(sig.level/tside,
         lower.tail = FALSE) * sqrt((p1 + p2) * (1 - (p1 +
          p2)/2))))/sqrt(p1 *
         (1 - p1) + p2 * (1 - p2)))))

by adding or subtracting 0.5 or 0.5/n in the appropriate places.


-- 
    O__  ---- Peter Dalgaard             Øster Farimagsgade 5, Entr.B
   c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
  (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)              FAX: (+45) 35327907



More information about the R-help mailing list