HyLown Power and Sample Size Calculators

Good News! These calculators have earned their own website! We'll leave these calculators here for now, but for our latest calculators please visit

PowerAndSampleSize.com.

For testing whether a rate, proportion, or probability, $p_1$, is equal to a reference value, $p_0$. The Null and Alternative hypotheses are

$H_0:p_1=p_0$ versus $H_1:p_1\neq p_0$

Sample Size

Power

X-axis

min

max

This sample size calculator uses the following formula: $$n=p_1(1-p_1)\left(\frac{\Phi^{-1}(\alpha/2)+\Phi^{-1}(\beta)}{p_1-p_0}\right)^2$$ where

  • $n$ is sample size
  • $p_1$ is the rate, proportion, or probability to be tested
  • $p_0$ is the comparison value
  • $\Phi^{-1}$ is the standard Normal quantile function
  • $\alpha$ is Type I error
  • $\beta$ is Type II error, meaning $1-\beta$ is power

R code to implement this function:

p0=0.3
p1=0.5
alpha=0.05
beta=0.20
(n=ceiling(p1*(1-p1)*((qnorm(alpha/2)+qnorm(beta))/(p1-p0))^2)) # 50

Reference: Chow, page 85