rsample-sizepower-analysis

Why R pwr.2p.test gives different sample size than G*Power?


I want to know the sample size required. In R

library(pwr)
pwr.2p.test(h = ES.h(0.022,0.001),sig.level = 0.05,power = 0.8,alternative = "greater")

gives the results

     Difference of proportion power calculation for binomial distribution (arcsine transformation) 

              h = 0.2344905
              n = 224.8784
      sig.level = 0.05
          power = 0.8
    alternative = greater

NOTE: same sample sizes

In G*Power tool, the result is enter image description here

My question is, why the sample sizes from R and G*Power differ so much (225 vs 318)? Thanks.


Solution

  • The reason for the difference is that pwr:pwr.2p.test uses a different approach for calculating Cohen's effect size h, i.e. it uses arcsin transformation. In contrast, GPower as well as the built-in power test from the stats library use an approximation.

    To match results between pwr and GPower, go to GPower and when entering your model details, select "Options" at the bottom and turn on arcsin transformation.

    Quote from GPower documentation (bolding added by me):

    Numerous procedures have been proposed to test the null hypothesis that two independent proportions are identical (Cohen, 1988; DAgostino, Chase, & Belanger, 1988; Suissa & Shuster, 1985; Upton, 1982), and G*Power 3 implements several of them. The simplest procedure is a z test with optional arcsin transformation and optional continuity correction. Besides these two computational options, one can also choose whether Cohens effect size measure h or, alternatively, two proportions are used to specify the alternate hypothesis. With the options Use continuity correction off and Use arcsin transform on, the procedure calculates power values close to those tabulated by Cohen (1988, chap. 6). With both Use continuity correction and Use arcsin transform off, the uncorrected 2 approximation is computed (Fleiss, 1981); with Use continuity correction on and Use arcsin transform off, the corrected 2 approximation is computed (Fleiss, 1981).

    Source: https://paperity.org/p/19044909/g-power-3-a-flexible-statistical-power-analysis-program-for-the-social-behavioral-and