How Do You Calculate Sample Size for a Quality Study?

Sample size calculation is one of the most frequently asked questions in quality engineering, yet it is also one of the most misunderstood. Whether you are planning a process capability study, an audit sampling plan, or a customer satisfaction survey, the number of units you inspect or measure directly affects the confidence you can place in your conclusions. This article explains the logic behind sample size formulas, how to apply them, and where they come from.

What It Is

Sample size calculation is the process of determining the minimum number of observations or units needed to estimate a population parameter (such as a mean or a proportion) with a specified level of precision and confidence—or to detect a specified effect size in a hypothesis test with adequate statistical power.

The methods used here follow standard practice based on the normal approximation to the binomial and t-distributions, consistent with widely accepted references for mean and proportion estimation. For attribute sampling in lot inspection, the same logic underpins the sample size tables in ISO 2859 (sampling procedures for inspection by attributes), though those tables also incorporate producer and consumer risk considerations.

How It Works: Formula or Steps

The core idea is simple: the larger the sample, the smaller the sampling error. But larger samples cost more. The formula balances precision, confidence, and variability.

### 1. Estimating a Mean

To estimate a population mean with a desired absolute precision ε (half-width of the confidence interval) and confidence level (1−α), the required sample size is:

n = (z² · σ²) / ε²

Where:
  • z = the z-value for the desired confidence level (e.g., 1.96 for 95% confidence)
  • σ = the estimated population standard deviation
  • ε = the maximum acceptable margin of error (precision)


If σ is unknown, use a pilot study estimate or a historical value. For small samples, replace z with the t-value, which will increase n slightly.

### 2. Estimating a Proportion

To estimate a population proportion p with precision ε and confidence level (1−α):

n = (z² · p(1−p)) / ε²

Where:
  • p = the expected proportion (if unknown, use 0.5, which maximizes the required sample size)
  • ε = the maximum acceptable margin of error


### 3. Power for Hypothesis Tests

For a two-sided test comparing a mean to a target, the sample size needed to achieve power (1−β) is:

n = ((z₁₋α/₂ + z₁₋β)² · σ²) / δ²

Where:
  • δ = the minimum difference you want to detect
  • z₁₋α/₂ = 1.96 for α = 0.05
  • z₁₋β = 0.84 for 80% power, or 1.28 for 90% power


These formulas assume a normal approximation, which is valid when the sample size is sufficiently large (typically n ≥ 30 for means, and np ≥ 5 and n(1−p) ≥ 5 for proportions).

A Worked Illustrative Example

Example data (illustrative only): Suppose you want to estimate the average fill weight of a bottling line. From historical records, the standard deviation is σ = 2.0 g. You want a 95% confidence interval with a margin of error no larger than ε = 0.5 g.

Using the mean formula:

n = (1.96² · 2.0²) / 0.5² = (3.8416 · 4) / 0.25 = 15.3664 / 0.25 = 61.47

Round up to n = 62 bottles.

Now suppose instead you want to estimate the proportion of nonconforming items. Without prior data, use p = 0.5 to be conservative. With 95% confidence and ε = 0.05:

n = (1.96² · 0.5 · 0.5) / 0.05² = (3.8416 · 0.25) / 0.0025 = 0.9604 / 0.0025 = 384.16

Round up to n = 385 units.

Notice how the proportion formula requires a much larger sample than the mean formula for similar precision—this is typical.

Common Pitfalls

  • Using p = 0.5 when you know the proportion is small. This gives an unnecessarily large sample. Use the best available estimate, or plan a two-stage approach.
  • Ignoring the finite population correction. If your sample is more than 5% of the total population, the required sample size decreases. The correction factor is: n_adj = n / (1 + (n−1)/N), where N is the population size.
  • Confusing precision with confidence. Precision is the width of the interval; confidence is the probability that the interval contains the true value. Both must be specified.
  • Rounding down. Always round the calculated sample size up to the next integer.


Start Calculating

Getting the sample size right saves time, money, and rework. Whether you are estimating a mean, a proportion, or planning a hypothesis test, the formulas above give you a defensible, standard-based answer. To avoid manual errors and get results in seconds, use the free sample size calculator at https://www.6sq.com/tools/sample_size/ — it handles the math so you can focus on the decision.
Invited:

0 replies, guests cannot view replies. For more features, please log in or register