Sample size for a paired t test, and why pairing saves parts
Sample size for a paired t test is the number of pairs you need so that a paired t test detects a given mean difference with a chosen power. Each pair is two measurements on the same unit, such as before and after a treatment, or the same part on two gauges. The test works on the differences, so the calculation is the same as for a 1-sample t test, with the standard deviation of the differences, σ_d, in place of σ.
When to use it
- Each unit can be measured under both conditions: two gauges, two operators, before and after a process step, left and right side of the same part.
- The unit-to-unit variation is large compared with the difference you want to find. Pairing removes it from the comparison.
- You need to decide between a paired design and two independent groups, and want to see the cost of each.
How it works
For n pairs with differences dᵢ, the paired t statistic follows a noncentral t distribution with n − 1 degrees of freedom and noncentrality
λ = δ √n / σ_dwhere δ is the true mean difference. The two-sided power is P(T′ > t₁₋α/₂, n−1) + P(T′ < −t₁₋α/₂, n−1). Increase n until the power reaches the target.
The key planning number is σ_d. If both measurements have the same standard deviation σ and correlate with coefficient ρ across units:
σ_d = σ √( 2 (1 − ρ) )When the two readings of a unit track each other closely (ρ near 1), σ_d is small and few pairs are needed. When ρ is near 0, pairing gains nothing. The best source for σ_d is a small pilot set of pairs; failing that, estimate σ and ρ from past data.
A normal approximation, n ≈ ((z₁₋α/₂ + z₁₋β) σ_d / δ)², plus Guenther's correction z²₁₋α/₂ / 2, usually lands on the exact answer.
Example
A machining cell wants to know whether a new air gauge reads bores differently from the reference bore gauge. Each part will be measured on both gauges. A pilot of eight parts gave a standard deviation of the differences of σ_d ≈ 0.8 µm, while bores vary from part to part with σ ≈ 1.5 µm. A bias of 0.6 µm would matter. Plan: two-sided test, α = 0.05, power 0.80.
- Normal approximation: ((1.960 + 0.842) × 0.8 / 0.6)² = 13.95, so 14 parts. Exact power with 14 is only 0.737.
- Guenther's correction: 13.95 + 1.960²/2 = 15.87, so 16.
- Exact noncentral t: 15 parts give 0.771; 16 parts give 0.801.
A simulation of 200,000 sets of 16 differences with mean 0.6 µm and σ_d = 0.8 µm (NumPy, seed 11) rejected in 80.2% of the sets.
Now compare with an unpaired design: measure one group of parts on the new gauge and a different group on the reference gauge. The comparison then carries the part-to-part σ of 1.5 µm, and the 2-sample t calculation needs 100 parts per gauge (power 0.804), 200 parts in all. Pairing does the job with 16 parts, each measured twice. The implied correlation between the two gauges' readings is ρ = 1 − 0.8²/(2 × 1.5²) = 0.86.
How to read the results
- Sixteen parts measured on both gauges give an 80% chance of detecting a 0.6 µm bias.
- The curves show the trade-off. A 0.8 µm bias would already be found 80% of the time with 10 parts; a 0.4 µm bias needs about 30 parts for 75%.
- The saving comes from ρ. Here the part-to-part variation is shared by both readings and cancels in the difference. That is why pairing cut the parts from 200 to 16.
- If the goal is to show the gauges agree, not to find a difference, plan an equivalence test instead. Failing to find a bias is not proof that there is none.
Common mistakes
- Planning with σ instead of σ_d. Using the part-to-part standard deviation for a paired design overstates the sample size. In the example, σ = 1.5 µm in place of σ_d = 0.8 µm would ask for 52 parts instead of 16.
- Pairing units that are not really linked. Two parts that happen to be next to each other in a list are not a pair. A pair shares the unit (or the batch, or the time) that you want to cancel out.
- Order effects. If every part goes to gauge A first, any change caused by handling or temperature becomes part of the difference. Alternate or randomize the order.
- Repeat readings counted as pairs. Ten readings of one part on each gauge give one pair, not ten.
Frequently asked questions
How do I get σ_d before I have the data?
Run a small pilot of five to ten pairs, or estimate σ and the correlation ρ from earlier studies and use σ_d = σ√(2(1 − ρ)). If the pilot is small, plan with a value somewhat above its estimate.
Is a paired test always better?
It is better whenever the paired readings are positively correlated, which is the usual case. If ρ is near zero, a paired design gives no gain and loses half the degrees of freedom of a 2-sample design.
Do the differences need to be normal?
The t test assumes the differences are roughly normal. With 15 or more pairs, moderate departures do little harm; for strongly skewed differences, consider a Wilcoxon signed-rank test and size it by simulation.
Can I use this for before and after measurements?
Yes, if the same units are measured both times. Make sure nothing else changed between the two measurements, or the difference will include it.