7.6 Sample Size for Hypothesis Tests
Key Takeaways
- Sample size depends on four quantities: alpha, power, the difference to be detected, and the process standard deviation.
- For a two-sided two-sample comparison of means, n per group is approximately 2 times the square of (z alpha over 2 plus z beta) times sigma squared divided by delta squared.
- Required sample size scales with the inverse square of the effect size, so halving the detectable difference quadruples the sample.
- Attribute data requires far larger samples than continuous data for the same practical sensitivity.
- Power is one minus beta, the probability of correctly detecting a real difference; 80% or 90% are the conventional targets.
The four inputs
Every sample size calculation needs the same four quantities, and three of them are business decisions rather than statistical ones.
| Input | Symbol | Typical value | Who decides |
|---|---|---|---|
| Significance level | $\alpha$ | 0.05 | Team, from the cost of a false alarm |
| Power | $1 - \beta$ | 0.80 or 0.90 | Team, from the cost of missing a real effect |
| Difference to detect | $\delta$ | The practical threshold | Process owner or customer |
| Process standard deviation | $\sigma$ | From baseline data or a pilot | Measured |
The most common failure is treating $\delta$ as a statistical parameter. It is not: it is the smallest difference worth detecting, and it comes from the economics of the process. If a 2% yield improvement is the smallest change that would justify implementation, size the study to detect 2%.
Standard normal values needed:
| Quantity | Value |
|---|---|
| $z_{\alpha/2}$ at $\alpha = 0.05$ two-sided | 1.960 |
| $z_{\alpha}$ at $\alpha = 0.05$ one-sided | 1.645 |
| $z_{\beta}$ at 80% power | 0.842 |
| $z_{\beta}$ at 90% power | 1.282 |
Comparing two means
For a two-sided test of $H_0: \mu_1 = \mu_2$ with equal group sizes:
At $\alpha = 0.05$ two-sided and 80% power, $(1.960 + 0.842)^2 = 7.85$, so a useful shortcut is
Worked example. A team wants to detect a 1.5-unit shift in mean cycle time. Baseline data gives $\sigma = 3.0$ units. At $\alpha = 0.05$ and 80% power:
Always round up. Raising power to 90% changes the multiplier to $(1.960 + 1.282)^2 = 10.51$ and the requirement to 85 per group -- a 35% increase in data for a 10 percentage point gain in power.
One sample against a target
Exactly half the two-sample requirement, because only one mean is being estimated.
When sigma is unknown and n is small
These formulas use $z$ values, which assumes $\sigma$ is known. When $\sigma$ is estimated from the sample, the $t$ distribution applies and the requirement is slightly larger. The standard practical fix is to compute with $z$, then add two to four observations per group, or iterate using $t$ values at the resulting degrees of freedom. For $n$ above about 30 per group the difference is negligible.
Comparing two proportions
Worked example. Current defect rate is 5%, and the team wants to detect a reduction to 3%. At $\alpha = 0.05$ two-sided and 80% power:
- $p_1(1-p_1) = 0.05 \times 0.95 = 0.0475$
- $p_2(1-p_2) = 0.03 \times 0.97 = 0.0291$
- Sum $= 0.0766$; $(p_1 - p_2)^2 = (0.02)^2 = 0.0004$
Just over 1,500 units per group -- 3,000 units in total -- to detect a 2 percentage point change. This single result explains why continuous data is preferred wherever it is available: a comparable continuous study typically needs a few dozen observations per group.
One sample against a target proportion
The inverse-square relationship
Because $\delta$ appears squared in the denominator, sensitivity is expensive:
| Detectable difference | Relative sample size |
|---|---|
| $\delta$ | 1x |
| $\delta / 2$ | 4x |
| $\delta / 4$ | 16x |
The same relationship works in your favour on the other side: halving $\sigma$ quarters the required sample. Improving the measurement system is therefore often cheaper than collecting more data. If gage R&R contributes a large share of the observed variance, fixing the gauge reduces $\sigma$ and shrinks every subsequent sample size requirement.
Power analysis after the fact
If a study has already been run and returned a non-significant result, compute the difference it was actually able to detect:
With $n = 12$ per group and $\sigma = 3.0$:
The study could only detect a shift of 3.4 units. Reporting "no significant difference" when the practically important difference was 1.5 units is misleading; the honest statement is that the study was inconclusive.
Practical adjustments
| Situation | Adjustment |
|---|---|
| Expected dropout, invalid records, or destructive test loss | Inflate $n$ by the expected loss fraction |
| Unequal group sizes with ratio $k$ | $n_1 = \frac{(1 + 1/k)}{2} \times n_{equal}$ |
| Multiple comparisons | Use a Bonferroni-adjusted $\alpha$ in the calculation |
| Finite population | Apply the finite population correction when $n/N > 0.05$ |
| Clustered or subgrouped data | Inflate by the design effect; observations within a cluster are not independent |
Sizing checklist
- Is $\delta$ the smallest practically important difference, agreed with the process owner?
- Is $\sigma$ from real baseline data on this process, not a textbook value?
- Does $\sigma$ include measurement variation, and would improving the gauge be cheaper than more data?
- Are $\alpha$ and power chosen from the relative cost of the two errors?
- Has $n$ been rounded up and inflated for expected loss?
- Is collecting that many observations feasible in the project timeline? If not, renegotiate $\delta$ or power before collecting, not after.
A team wants to detect a 1.5-unit shift in a mean with sigma = 3.0, alpha = 0.05 two-sided, and 80% power. Approximately how many observations per group are required?
A team must detect a reduction in defect rate from 5% to 3% at alpha = 0.05 and 80% power. Roughly how many units per group are needed, and what does the result illustrate?
A completed study with 12 observations per group and sigma = 3.0 reports no significant difference. The practically important difference was 1.5 units. What should be reported?