Inspector pulling filled sachets from a conveyor to weigh them on a precision scale in a packaging plant

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.

SAMPLE SIZE
Visual map 149: Sample Size Calculation: Formula and Worked Example. Click the map to see it full size.Download the map as PNG

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.

Advertisement

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:

ConfidencezMargin E (g)Calculated nn to collect
90%1.6450.543.344
95%1.960.561.562
99%2.5760.5106.2107
95%1.961.015.416

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.

When the process has few defects, using p = 0.5 greatly overstates the size. Even rough history saves collection effort.

Advertisement

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

  1. Define what to estimate: a mean (variable data) or a proportion (attribute data).
  2. Set the margin of error E from the decision to be made, not from what fits the routine.
  3. Choose the confidence level (95% is usual) and get z.
  4. Get σ or p: from history, from a pilot of 15 to 30 parts or, failing that, use p = 0.5.
  5. Calculate n, round up and correct for a finite population if needed.
  6. Sample randomly or stratified by shift, machine and lot, and record on a check sheet.

Sample size, AQL and control charts

GoalToolWhen
Estimate a mean or proportion with a margin of errorFormulas in this articleProcess study, validation, survey
Accept or reject a lotAQL plan (ISO 2859-1)Receiving and final inspection
Watch stability over timeControl chartsContinuous production
Estimate capabilityCp and CpkTypically 30 to 50 stable measurements

Common mistakes

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.

Advertisement

Sources

  1. MONTGOMERY, D. C. Introduction to Statistical Quality Control. Wiley.
  2. COCHRAN, W. G. Sampling Techniques. Wiley.
  3. WERKEMA, M. C. C. Ferramentas Estatísticas Básicas para o Gerenciamento de Processos. Belo Horizonte: Fundação Christiano Ottoni.
  4. 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
Photo of Vagner Soares

About the author

Vagner Soares

Lean Manufacturing & Behavioral Management Specialist

Over 20 years in the automotive and metalworking industries (GM and Dana), Lean Manufacturing practitioner since 2006. SENAI instructor and mentor in Brazil’s Brasil Mais Produtivo program, delivering consulting, training and audits for 50+ companies, combining quality, productivity and people development.