Menu
Inputs
Calculate Sample Size Needed to Test 1 Proportion: 1-Sample, 1-Sided
This calculator is useful for tests concerning whether a proportion, , is equal to a reference value, . The Null and Alternative hypotheses are
or
Formulas
This calculator uses the following formulas to compute sample size and power, respectively:
where
is sample size
is the comparison value
is the standard Normal distribution function
is the standard Normal quantile function
is Type I error
is Type II error, meaning is power
R Code
1p=0.05
2p0=0.02
3alpha=0.05
4beta=0.20
5(n=p0*(1-p0)*((qnorm(1-alpha)+qnorm(1-beta)*sqrt(p*(1-p)/p0/(1-p0)))/(p-p0))^2)
6ceiling(n) # 191
7z=(p-p0)/sqrt(p0*(1-p0)/n)(Power=pnorm(sqrt(p0*(1-p0)/p/(1-p))*(abs(z)-qnorm(1-alpha))))References
Chow S, Shao J, Wang H. 2008. Sample Size Calculations in Clinical Research. 2nd Ed. Chapman & Hall/CRC Biostatistics Series. page 85.