Use case: Determine the required sample size to test if a population proportion differs from a specific hypothesized value. This ensures enough power to detect a minimum effect at a chosen significance level.
You input the baseline (null) proportion, $p_0$, and the effect size, $\Delta$. The effect size ($\Delta$) represents the difference between the alternative proportion ($p_1$) and the null proportion ($p_0$), so $p_1 = p_0 + \Delta$.
- Enter a positive $\Delta$ to detect an increase in proportion (e.g., from $p_0 = 0.5$ to $p_1 = 0.6$, $\Delta = 0.1$).
- Enter a negative $\Delta$ to detect a decrease in proportion (e.g., from $p_0 = 0.5$ to $p_1 = 0.4$, $\Delta = -0.1$).
Note: Both $p_0$ and $p_1$ must be strictly between 0 and 1. The calculator will validate that your chosen $\Delta$ results in a valid $p_1$.
The classic sample size formula used is:
$$n = \frac{\left[ z_{1-\alpha/2} \sqrt{p_0(1-p_0)} + z_{1-\beta} \sqrt{p_1(1-p_1)}\right]^2}{(p_1 - p_0)^2}$$
For one-sided tests, use $z_{1-\alpha}$ instead of $z_{1-\alpha/2}$.
- $z_{1-\alpha/2}$: Z-score for significance (e.g., 1.96 for $\alpha=0.05$, two-sided; or $z_{1-\alpha}$ for one-sided)
- $z_{1-\beta}$: Z-score for desired power
- $p_0$: hypothesized (null) proportion (user input)
- $p_1$: alternative proportion, calculated as $p_1 = p_0 + \Delta$
Example:
Suppose you want to detect an increase from $p_0 = 0.5$ by $\Delta = 0.1$ (i.e., to $p_1 = 0.6$), with $\alpha = 0.05$ (two-sided, $z_{1-\alpha/2} = 1.96$), and 80% power ($z_{1-\beta} = 0.84$):
$$n = \frac{\left[ 1.96 \times \sqrt{0.5 \times 0.5} + 0.84 \times \sqrt{0.6 \times 0.4} \right]^2}{(0.6-0.5)^2} \\ = \frac{(0.98 + 0.4115)^2}{0.01} \approx \frac{1.937}{0.01} = 193.7 \implies 194$$
Interpretation: You need at least 194 samples to have an 80% chance of detecting an increase from 50% to 60% at a 5% significance level.