GARETH GRANTTECHNOLOGY · DATA · INNOVATION
Explore

38 / Quality & reliability

Attribute control charts: p, np, c and u

Attribute charts monitor counts classified as pass/fail or counts of defects. Choosing the correct denominator prevents a busy week from appearing worse merely because more work was inspected.

IntermediateLive exploration + Python

The business question

Is the rate of failures or defects changing after allowing for inspection volume?

  • Monitor the fraction of orders with an error when order volumes vary.
  • Track defects per inspected item or area when several defects can occur on one unit.

How the method works

A p chart treats each inspected unit as conforming or nonconforming. An order with three errors is still one failed order for this chart. Pool baseline failures and inspected units to estimate the underlying fraction, then calculate limits separately for each new sample size. Small samples have wider proportion limits because they contain less information.

An np chart shows the number of failed units when the inspection size is constant. A c chart monitors the number of defects when the opportunity for defects stays comparable. A u chart monitors defects per unit of exposure when exposure changes. A unit can contribute several defects to a c or u chart; it cannot contribute several failed units to a p chart.

Use a justified stable baseline, establish the inspection definition, then freeze it for monitoring. The familiar three-sigma p limits use a normal approximation to binomial variation; very sparse failures or extreme probabilities may need exact methods or a different chart. For defect counts, check whether clustering or overdispersion makes the Poisson assumption inadequate before trusting a narrow limit.

The calculation

p_bar = sum(failed_i)/sum(n_i); p limits_i = p_bar ± 3 sqrt[p_bar(1−p_bar)/n_i], clipped to [0,1]. u_bar = sum(defects_i)/sum(exposure_i); u limits_i = u_bar ± 3 sqrt(u_bar/exposure_i), with lower limit at least 0.
Read the symbols
SymbolMeaning
n_iNumber of inspected units in sample i.
failed_iNumber of units failing the defined acceptance rule, counted once each.
exposure_iComparable defect opportunity, such as units, square metres or inspection hours.

A worked business example

ILLUSTRATIVE SCENARIO

Illustrative dispatch department: baseline samples have different numbers of inspected orders.

Inputs

  • Baseline failed orders: 4, 6, 5, 3, 7.
  • Baseline inspected orders: 100, 150, 120, 80, 150.
  • New sample: 20 failed orders among 200 inspected.

Work through the numbers

  1. Pool the baseline: 25 failed / 600 inspected = 0.0416667, or 4.16667%.
  2. For n = 200, standard error = sqrt(0.0416667 × 0.9583333 / 200) = 0.01412985.
  3. Upper p limit = 0.0416667 + 3 × 0.01412985 = 0.0840562, or 8.40562%.
  4. The calculated lower limit is negative, so display 0.
  5. The new failed fraction is 20 / 200 = 10%, above the upper limit.
The sample signals an unusual failed-order fraction against the illustrative baseline.

Investigate why this sample differs, including inspection changes and clustered order types. A higher count alone would not establish deterioration without its denominator.

Explore the decision

Explore nonconforming-item proportions. The live explorer has its own example inputs; it is separate from the worked calculation above.

Enable JavaScript to use this calculator. The worked example and executable Python remain available.

Apply it at work

  1. Define failed units separately from individual defects and specify what counts as comparable inspection exposure.
  2. Collect baseline counts and denominators over representative time periods with consistent inspection.
  3. Check stability and plausible binomial or Poisson variation, then fix chart parameters and sample-specific limits.
  4. Investigate signals using order mix, operator, product and supplier records before adopting corrective action.

Check these assumptions

  • Units or defect opportunities are approximately independent within the chosen model.
  • The baseline probability or defect rate is reasonably stable under the defined operating condition.
  • Inspection sensitivity, classification rules and exposure definitions remain consistent.
  • A normal approximation is suitable for the displayed limits; sparse counts receive appropriate special treatment.

Common mistakes and how to avoid them

  • Averaging sample percentages without weighting by inspected units gives the wrong pooled baseline when sample sizes differ.
  • Confusing defects with defective units can put counts above the binomial denominator and invalidate the p chart.
  • Overdispersion from clustering, changing product mix or inconsistent inspectors can create too many apparent signals.

How this can help the business

  • Managers can compare error performance fairly across different production or customer-service volumes.
  • A defensible rate monitor helps distinguish changing workload from changing quality before committing to training or equipment changes.
A decision rule to adapt

Investigate a sample-specific signal after checking the denominator and inspection process; assess whether the proposed change reduces the relevant error rate without weakening inspection.

When to use another approach

Use stratified charts for genuinely different product families, rare-event charts for very sparse failures, or an overdispersion-aware method when the simple count model is inadequate.

Reproduce the worked example in Python

The code is self-contained for this example. Dependencies and run instructions are included with the downloadable notebook.

Show executable code and recorded output
import numpy as np
failed = np.array([4,6,5,3,7])
inspected = np.array([100,150,120,80,150])
p = failed.sum() / inspected.sum()
new_n = 200
lower = max(0, p - 3 * np.sqrt(p * (1-p) / new_n))
upper = min(1, p + 3 * np.sqrt(p * (1-p) / new_n))
new_rate = 20 / new_n
print("Baseline failure %:", round(100*p, 3))
print("New-sample limits %:", round(100*lower, 3), round(100*upper, 3))
print("New failure %:", round(100*new_rate, 3))
print("Investigation signal:", new_rate < lower or new_rate > upper)

Recorded output

Baseline failure %: 4.167
New-sample limits %: 0 8.406
New failure %: 10.0
Investigation signal: True
Download all worked examples

Sources and further reading

Concepts are linked to primary teaching or technical sources. The business examples are illustrative applications, not reported client results.