
- Sample size: what it is and when to calculate it
- Visual map of sample size
- Formulas: mean and proportion
- Example 1: sachet weight (mean)
- Example 2: fraction defective (proportion)
- Finite population correction
- Step by step to set the sample
- Sample size, AQL and control charts
- Common mistakes
- Frequently asked questions
Sample size: what it is and when to calculate it
The sample size (n) is the number of parts or measurements needed to estimate a mean or a proportion with a defined margin of error and confidence level. Calculating it before collecting data avoids two problems: measuring too much and wasting time, or measuring too little and drawing weak conclusions.
The goal here is to estimate a process characteristic. To accept or reject a lot, the route is different: AQL sampling per ISO 2859-1. To watch the process over time, use SPC control charts.
Visual map of sample size
The map shows both formulas (mean and proportion), the finite population correction and the worked examples.

Formulas: mean and proportion
To estimate a mean with margin of error E, knowing (or estimating) the standard deviation σ:
n = (z × σ ÷ E)²
To estimate a proportion p (for example, the fraction defective):
n = z² × p × (1 − p) ÷ E²
The z value comes from the confidence level: 1.645 for 90%, 1.96 for 95% and 2.576 for 99%. Always round the result up. If p is unknown, use p = 0.5, which gives the largest possible n and is therefore the safe case. For more on σ and the process curve, see normal distribution and standard deviation.
Example 1: sachet weight (mean)
Illustrative example. A line fills sachets and history shows σ = 2.0 g. You want to estimate the mean weight within ±0.5 g at 95% confidence.
n = (1.96 × 2.0 ÷ 0.5)² = 7.84² = 61.47 → 62 sachets
σ changes the result, and so does the margin. See how n reacts to each decision:
| Confidence | z | Margin E (g) | Calculated n | n to collect |
|---|---|---|---|---|
| 90% | 1.645 | 0.5 | 43.3 | 44 |
| 95% | 1.96 | 0.5 | 61.5 | 62 |
| 99% | 2.576 | 0.5 | 106.2 | 107 |
| 95% | 1.96 | 1.0 | 15.4 | 16 |
Doubling the margin of error cuts n to a quarter. Raising confidence from 95% to 99% nearly doubles the collection effort.
Example 2: fraction defective (proportion)
Illustrative example. You want to estimate a process fraction defective within ±3 percentage points at 95% confidence.
- With p estimated at 5% (from history): n = 1.96² × 0.05 × 0.95 ÷ 0.03² = 0.1825 ÷ 0.0009 = 202.75, so 203 parts.
- With no information (p = 0.5) and a ±5 point margin: n = 1.96² × 0.5 × 0.5 ÷ 0.05² = 384.16, so 385 parts.
When the process has few defects, using p = 0.5 greatly overstates the size. Even rough history saves collection effort.
Finite population correction
If the lot or population (N) is small and the sample would exceed about 5% of it, the formula overstates n. Apply:
nadjusted = n₀ ÷ [1 + (n₀ − 1) ÷ N]
With N = 1,000 and n₀ = 384.16 (proportion, ±5 points, 95%): n = 384.16 ÷ (1 + 383.16 ÷ 1,000) = 384.16 ÷ 1.38316 = 277.7, so 278 parts instead of 385. When N is very large relative to n, the correction is negligible and the result is unchanged.
Step by step to set the sample
- Define what to estimate: a mean (variable data) or a proportion (attribute data).
- Set the margin of error E from the decision to be made, not from what fits the routine.
- Choose the confidence level (95% is usual) and get z.
- Get σ or p: from history, from a pilot of 15 to 30 parts or, failing that, use p = 0.5.
- Calculate n, round up and correct for a finite population if needed.
- Sample randomly or stratified by shift, machine and lot, and record on a check sheet.
Sample size, AQL and control charts
| Goal | Tool | When |
|---|---|---|
| Estimate a mean or proportion with a margin of error | Formulas in this article | Process study, validation, survey |
| Accept or reject a lot | AQL plan (ISO 2859-1) | Receiving and final inspection |
| Watch stability over time | Control charts | Continuous production |
| Estimate capability | Cp and Cpk | Typically 30 to 50 stable measurements |
Common mistakes
- Rounding down. The calculated n is a minimum; 61.47 becomes 62.
- Guessing σ or p without a basis. A small pilot or history gives a better estimate and makes the calculation defensible.
- Unrepresentative sample. Collecting only at shift start or from one machine skews the result, whatever n is.
- Ignoring the measurement system. More parts do not fix a poor gauge. See MSA and Gauge R&R.
- Using the proportion formula with very few defects without checking that the sample will contain enough occurrences for the estimate to make sense.
- Forgetting the finite population in small lots and inspecting more parts than needed.
Frequently asked questions
How do you calculate sample size?
For a mean, n = (z × σ ÷ E)². For a proportion, n = z² × p × (1 − p) ÷ E². Always round up.
Which z value should I use?
1.645 for 90% confidence, 1.96 for 95% and 2.576 for 99%.
What if I do not know the standard deviation or the proportion?
Use historical data or a pilot of 15 to 30 parts to estimate σ. For a proportion with no information, use p = 0.5, which gives the largest n.
What is the difference between sample size and an AQL plan?
Sample size estimates a characteristic with a margin of error. An AQL plan defines how many parts to inspect and how many defectives to accept in order to approve a lot.
When do I need the finite population correction?
When the sample exceeds about 5% of the lot size. With N = 1,000, n drops from 385 to 278 in the example.
How many parts are enough to calculate Cpk?
As a practical reference, 30 to 50 measurements under stable conditions, but ideally set it by the precision the study requires.
Sources
- MONTGOMERY, D. C. Introduction to Statistical Quality Control. Wiley.
- COCHRAN, W. G. Sampling Techniques. Wiley.
- WERKEMA, M. C. C. Ferramentas Estatísticas Básicas para o Gerenciamento de Processos. Belo Horizonte: Fundação Christiano Ottoni.
- ISO 2859-1. Sampling procedures for inspection by attributes — Part 1: Acceptance quality limit (AQL) indexed lot-by-lot sampling plans.
Keep studying: trusted sources and links
Save this address: Manufatura Enxuta is your school for lean manufacturing. Come back whenever you need to study, with a complete article, a visual map and trusted sources. Follow one of the learning paths or check the A–Z glossary.
Want a quick reference guide for the factory floor?
Download the free Pocket Guide e-book with the Lean tools summarized on one page each.
Download the e-book
