Menu
Inputs
Calculate Sample Size Needed to Test 1 Proportion: 1-Sample, 2-Sided Equality
This calculator is useful for tests concerning whether a proportion, , is equal to a reference value, . The Null and Alternative hypotheses are
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.5
2p0=0.3
3alpha=0.05
4beta=0.20(n=p*(1-p)*((qnorm(1-alpha/2)+qnorm(1-beta))/(p-p0))^2)
5ceiling(n) # 50
6z=(p-p0)/sqrt(p*(1-p)/n)(Power=pnorm(z-qnorm(1-alpha/2))+pnorm(-z-qnorm(1-alpha/2)))References
Chow S, Shao J, Wang H. 2008. Sample Size Calculations in Clinical Research. 2nd Ed. Chapman & Hall/CRC Biostatistics Series. page 85.