Last chance! 50% off unlimited learning
Sale ends in
Computes the sample size in each group required to estimate a difference of proportions with desired confidence interval precision in a 2-group design. Set the proportion planning values to .5 for a conservatively large sample size. Set R = 1 for equal sample sizes.
size.ci.prop2(alpha, p1, p2, w, R)
Returns the required sample size for each group
alpha level for 1-alpha confidence
planning value of proportion for group 1
planning value of proportion for group 2
desired confidence interval width
n2/n1 ratio
size.ci.prop2(.05, .4, .2, .15, 1)
# Should return:
# n1 n2
# 274 274
size.ci.prop2(.05, .4, .2, .15, .5)
# Should return:
# n1 n2
# 383 192
Run the code above in your browser using DataLab