Computes the sample size in each group required to test a difference in population proportions with desired power and a continuity correction in a 2-group design. This function requires planning values for both proportions. Set each proportion planning value to .5, or a value closest to .5 within a plausible range, for a conservatively large sample size requirement. This function does not use the typical sample size approach where the effect size is assumed to equal the difference in proportion planning values. This function does not require the planning value for the proportion difference (effect size) to equal the difference of the two proportion planning values; for example, the planning value of the proportion difference could be set equal to a minimally interesting effect size.
size.test.prop2(alpha, pow, p1, p2, es)
alpha level for hypothesis test
desired power
planning value of proportion for group 1
planning value of proportion for group 2
planning value of proportion difference (effect size)
Returns the required sample size for each group
size.test.prop2(.05, .8, .5, .5, .2)
#> Sample size per group
#> 109
# Should return:
# Sample size per group
# 109
size.test.prop2(.05, .8, .3, .1, .2)
#> Sample size per group
#> 71
# Should return:
# Sample size per group
# 71