How many samples do I need? Sample size for engineers
How many samples you need depends on the question you are asking. Detecting a difference, estimating a value to a stated precision, demonstrating a requirement and building a control chart each have their own logic, and each needs a different number. In every case the answer is driven by the same few things: how much the measurements vary, how small an effect or how narrow an interval matters to you, and how much risk of being wrong you accept. This guide walks through each kind of question with formulas, tables and a worked example.
Start with the question
| Question | What you choose | Where to look |
|---|---|---|
| Is there a difference? | α, power, smallest difference that matters, σ | 2-sample t, 1-sample t, proportions, ANOVA |
| How large is it? | Confidence level, margin of error, σ or p | Sample size for estimation |
| Does nearly every part meet the limit? | Coverage, confidence | Tolerance intervals |
| Which factors matter? | Effect size in σ units, power | Factorial designs, screening designs |
| Is the process stable and capable? | Mostly convention, plus the precision of the index | Below |
Detecting a difference: power
A test can make two errors: finding a difference that is not there (probability α, usually 0.05) and missing one that is (probability β). Power is 1 − β, the chance of detecting a difference of a given size. To size a test you state four things: α, the power you want (80% or 90% are common), the smallest difference δ that would matter, and the standard deviation σ. Only the ratio d = δ/σ matters.
For t tests at α = 0.05, two-sided, computed with the noncentral t distribution:
| d = δ/σ | 1-sample or paired, 80% power | 2-sample (per group), 80% power | 1-sample, 90% power | 2-sample (per group), 90% power |
|---|---|---|---|---|
| 0.5 | 34 | 64 | 44 | 86 |
| 1.0 | 10 | 17 | 13 | 23 |
| 1.5 | 6 | 9 | 7 | 11 |
| 2.0 | 5 | 6 | 5 | 7 |
Two quick rules follow from the normal approximation, for 80% power at α = 0.05:
2-sample t, per group: n ≈ 16 / d²
1-sample or paired t: n ≈ 8 / d²At d = 0.5 they give 64 and 32, against the exact 64 and 34. The rules also show the main lesson: n grows with 1/d², so halving the difference you want to detect multiplies the sample size by four.
Proportions need far more units than measurements. Detecting a drop in a scrap rate from 6% to 3% with 80% power takes about 750 parts per group, because a pass/fail result carries much less information than a measured value. See sample size for 2 proportions; where you can, measure the characteristic instead of counting defects.
Estimating a value: precision
When the goal is a number with a known margin of error E rather than a yes/no answer, the sample size comes from the width of the confidence interval:
Mean: n ≈ ( z σ / E )² (z = 1.96 for 95%)
Proportion: n ≈ z² p (1 − p) / E²Some 95% examples:
- A mean within ±0.25σ: (1.96/0.25)² = 61.5, so 62 with σ known; with σ estimated (t), 64.
- A standard deviation within ±20%: about 70 values.
- A proportion within ±3 percentage points, with no idea of the rate (p = 0.5): 1,068.
Demonstrating a requirement
Customers and standards often ask you to show that a requirement is met with a stated confidence, using a pass/fail test with no failures allowed. If all n units pass, you have demonstrated a reliability (or a conforming fraction) R with confidence C when
n ≥ ln(1 − C) / ln(R)| Demonstrate | Confidence | Units, zero failures |
|---|---|---|
| 90% | 90% | 22 |
| 95% | 95% | 59 |
| 99% | 95% | 299 |
With measured data and a normal distribution, a tolerance interval can make the same kind of claim with far fewer units, but only if the normal model holds.
Process capability: how sure is the index?
A capability index computed from a sample is an estimate, and it is less precise than most people expect. An approximate standard error for Cpk (Bissell's approximation) is
SE(Ĉpk) ≈ √( 1/(9n) + Ĉpk² / (2(n − 1)) )For an estimated Cpk of 1.33, the approximate 95% confidence intervals are:
| n | 95% interval for Cpk | 95% lower bound (one-sided) |
|---|---|---|
| 30 | 0.97 to 1.69 | 1.03 |
| 50 | 1.05 to 1.61 | 1.10 |
| 100 | 1.13 to 1.53 | 1.17 |
| 200 | 1.19 to 1.47 | 1.21 |
With 30 parts, a reported 1.33 is consistent with a true Cpk below 1.0. That is why capability studies commonly use 100 values or more, collected over enough time to include the normal sources of variation. See Cp, Cpk, Pp and Ppk.
Conventions for charts and gages
Some sample sizes are set by established practice rather than a power calculation:
- Control charts: limits are commonly computed from 20 to 25 subgroups (or about that many individual values for an individuals chart) and recomputed once more data are available. See choosing a control chart.
- Gage R&R: a common layout is 10 parts, 3 operators and 2 or 3 trials each. More parts improve the estimate of part variation more than extra trials do. See measurement system analysis.
These are starting points; check what your customer or standard requires.
Worked example
A plant is qualifying a second supplier for a molded bracket. The critical property is tensile strength, with σ ≈ 8 MPa from the current supplier's data. A drop in mean strength of 4 MPa would matter. The plan is a 2-sample t test at α = 0.05.
- Difference in σ units: d = 4/8 = 0.5.
- Sample size: 64 brackets per supplier for 80% power, 86 for 90%.
- What the first proposal would have given: the purchasing team had offered 20 brackets from each supplier. With 20 per group the power to detect 4 MPa is only 34%: two times out of three, a real 4 MPa drop would pass unnoticed.
- What 20 per group can detect: with 80% power, a difference of 0.91σ, about 7.3 MPa.
The team chooses 64 per supplier, taken from at least three resin lots and spread over two weeks so that the σ in the test resembles the σ in production. They also add the confidence interval for the difference in means to the report, so that a "no significant difference" can be read against the 4 MPa that matters.
Practical advice
- Get σ from real data close to the conditions of the study: a control chart, a previous study or a short pilot. The sample size grows with σ², so a planning σ that is 20% too low gives a sample about 36% too small.
- Sample to represent what you want to conclude about. Sixty-four consecutive parts from one hour tell you about that hour.
- Plan for losses. Add a few units for damaged samples or failed measurements.
- If n is fixed, turn the question around. Compute the smallest difference the available sample can detect, and say so in the report.
- Reduce the noise when you can. Pairing, blocking and a better measurement system shrink σ, and with it the sample size.
Frequently asked questions
Is 30 a magic sample size?
No. Around 30 the t distribution is close to the normal, which is where the folklore comes from, but 30 guarantees neither power nor precision. A Cpk from 30 parts, for example, has a 95% interval about ±0.36 wide around 1.33.
Does the size of the lot or population matter?
Only when the sample is a large fraction of a finite lot, roughly more than 10%. Otherwise the required sample size is the same for a lot of 5,000 or 5 million.
What if I cannot afford the sample size?
Report the difference the study can detect, consider a paired or blocked design to reduce σ, or run the study in stages and stop early if the answer is already clear, using a method designed for sequential testing.
Should I plan for 80% or 90% power?
80% is the usual minimum. Choose 90% when missing a real difference is costly, for example when a "no difference" result will approve a supplier or a process change. For a 2-sample t test, going from 80% to 90% power adds about a third to the sample size: 64 to 86 per group at d = 0.5.
Why does my calculation give a fraction?
Sample sizes are always rounded up. The power at the rounded-up n is slightly higher than the target.