STAT-235 · Lesson 11 of 12 · 30 min

Statistical quality control

Every process varies: no two shafts, pours of concrete or bottles of product are exactly alike. Statistical quality control distinguishes the ordinary, unavoidable variation of a stable process from variation with a specific, findable cause, such as a worn tool, a new batch of material or an untrained operator, and judges whether a stable process is good enough for its specification. This lesson covers the three main tools. Control charts, invented by Walter Shewhart at Bell Laboratories in the 1920s, monitor a process over time and signal when it changes. Process capability indices compare the natural spread of a stable process with its tolerance. Acceptance sampling decides whether to accept a lot of incoming material from a sample. The lesson draws on the sampling distributions of Lesson 6, the binomial and Poisson distributions of Lesson 4 and the measurement-system ideas of Lesson 2.

Common causes and special causes

Shewhart's key idea was that process variation has two sources. Common-cause variation is the combined effect of many small, ever-present influences: slight differences in raw material, vibration, temperature, measurement error. It is built into the process, and reducing it requires changing the process itself, usually a management decision. Special-cause (assignable-cause) variation comes from a specific event that is not part of the normal process: a broken tool, a mis-set machine, a contaminated batch. It can and should be found and removed by the people running the process.

A process with only common-cause variation is in statistical control: its output is predictable within limits. Two opposite mistakes are costly. Treating common-cause variation as if it had a special cause, adjusting the machine after every slightly high reading, actually increases variation (this is called tampering). Ignoring a special cause lets bad product accumulate. Control charts are designed to tell the two apart.

Control charts for measurements

A control chart plots a statistic from successive samples (subgroups) against time, with a centre line and control limits placed three standard errors either side. For measurements, the usual pair is the \(\bar{X}\) chart, which tracks the process mean, and the R (range) chart, which tracks its spread. Subgroups of n = 4 or 5 consecutive items are taken at regular intervals. From about 20 to 25 subgroups collected while the process seems stable, compute the grand mean \(\bar{\bar{x}}\) and the average range \(\bar{R}\). The limits are

\[\bar{X}\text{ chart: } \bar{\bar{x}} \pm A_2\bar{R}, \qquad R\text{ chart: } D_3\bar{R} \text{ to } D_4\bar{R}\]

where the constants depend on the subgroup size; for n = 5, \(A_2 = 0.577\), \(D_3 = 0\), \(D_4 = 2.114\), and the process standard deviation is estimated by \(\hat{\sigma} = \bar{R}/d_2\) with \(d_2 = 2.326\). The \(A_2\bar{R}\) term is simply \(3\hat{\sigma}/\sqrt{n}\), three standard errors of the subgroup mean (Lesson 6). Charts with standard deviations instead of ranges (\(\bar{X}\)–s charts) are preferred for larger subgroups, and an individuals chart handles processes where only one measurement is available at a time, such as a daily water quality result.

Worked problem

Setting up a shaft diameter chart

Twenty subgroups of five shaft diameters give a grand mean of 25.002 mm and an average range of 0.012 mm. Find the control limits for the \(\bar{X}\) and R charts, and estimate σ.

Show solution
  1. \(\bar{X}\) chart: \(25.002 \pm 0.577 \times 0.012 = 25.002 \pm 0.0069\), so 24.9951 to 25.0089 mm.
  2. R chart: from 0 to \(2.114 \times 0.012 = 0.0254\) mm.
  3. \(\hat{\sigma} = 0.012/2.326 = 0.0052\) mm.

Answer: X̄ limits 24.995 to 25.009 mm and an R chart upper limit of 0.025 mm. These are control limits, describing what the process does; they are not specification limits, describing what the customer needs, and the two must never be confused.

Reading a control chart

A point outside the control limits is the clearest signal of a special cause: for a stable, normal process, the chance is only 0.27% per point. Patterns inside the limits can also signal a change, and the Western Electric rules are widely used to catch them:

  • One point beyond the 3σ limits.
  • Two of three consecutive points beyond 2σ on the same side.
  • Four of five consecutive points beyond 1σ on the same side.
  • Eight consecutive points on the same side of the centre line.

Trends (six points steadily rising or falling) suggest tool wear or drift; cycles suggest shift-to-shift or temperature effects. Each extra rule catches small shifts sooner but adds false alarms, so plants choose a set suited to the cost of each. Performance is measured by the average run length (ARL), the average number of subgroups before a signal: about 370 for a stable process with the 3σ rule alone, but only a few subgroups after a large shift.

Control limits from 20 subgroups of shaft diameters, then monitoring 10 more after the process mean shifts by about 1.3σ.
import numpy as np

rng = np.random.default_rng(21)
# 30 subgroups of 5 shaft diameters (mm); the process mean shifts up by 0.006 mm after subgroup 20
data = rng.normal(25.002, 0.005, size=(30, 5))
data[20:] += 0.006
xbar, R = data.mean(axis=1), np.ptp(data, axis=1)

# Control limits from the first 20 subgroups (phase I), n = 5: A2 = 0.577, D4 = 2.114, d2 = 2.326
xbb, Rbar = xbar[:20].mean(), R[:20].mean()
UCL, LCL = xbb + 0.577 * Rbar, xbb - 0.577 * Rbar
print(f"Grand mean {xbb:.4f} mm, X-bar limits {LCL:.4f} to {UCL:.4f}, R chart UCL {2.114 * Rbar:.4f}")
out = [i + 1 for i in range(30) if xbar[i] > UCL or xbar[i] < LCL]
print("Subgroups outside the X-bar limits:", out)

# Rule: eight points in a row on the same side of the mean line
side = np.sign(xbar - xbb)
for i in range(7, 30):
    if abs(side[i - 7:i + 1].sum()) == 8:
        print(f"Run of eight on one side ends at subgroup {i + 1}")
        break

sigma = Rbar / 2.326
LSL, USL = 24.975, 25.025
Cp = (USL - LSL) / (6 * sigma)
Cpk = min(USL - xbb, xbb - LSL) / (3 * sigma)
print(f"Estimated sigma {sigma:.5f} mm: Cp = {Cp:.2f}, Cpk = {Cpk:.2f} (before the shift)")
Output
Grand mean 25.0022 mm, X-bar limits 24.9962 to 25.0082, R chart UCL 0.0220
Subgroups outside the X-bar limits: [23, 29]
Run of eight on one side ends at subgroup 28
Estimated sigma 0.00447 mm: Cp = 1.86, Cpk = 1.70 (before the shift)

The limits computed from the stable first period flag points beyond them after the shift, and the run rule also detects the change. Once signalled, the operator looks for the cause (here a tool offset) rather than simply adjusting and moving on. For detecting small, sustained shifts quickly, cumulative sum (CUSUM) and exponentially weighted moving average (EWMA) charts, which accumulate evidence across subgroups, are more sensitive than Shewhart charts.

X-bar control chart of 30 subgroup means of shaft diameter. The centre line is at 25.002 millimetres, with control limits at about 24.996 and 25.008. The first 20 points scatter randomly within the limits. After subgroup 20 the points move upward, staying above the centre line, and two points exceed the upper control limit.
An X̄ chart signalling a shift in the process mean after subgroup 20.

Control charts for attributes

When items are simply classified as defective or not, a p chart tracks the fraction defective in samples of size n. With average fraction \(\bar{p}\), the limits come from the binomial standard error (Lesson 4):

\[\bar{p} \pm 3\sqrt{\frac{\bar{p}(1 - \bar{p})}{n}}\]

with a negative lower limit replaced by zero. When counting defects per unit, such as flaws per square metre of sheet or errors per drawing, a c chart uses the Poisson standard deviation, \(\bar{c} \pm 3\sqrt{\bar{c}}\).

Worked problem

A p chart for assembled units

Daily samples of 200 assembled units have an average fraction defective of 0.030. Find the control limits. One day shows 15 defectives. Is that a signal?

Show solution
  1. Standard error: \(\sqrt{0.03 \times 0.97/200} = 0.0121\).
  2. Limits: \(0.030 \pm 0.036\), so 0 to 0.066.
  3. 15/200 = 0.075, above the upper limit.

Answer: Yes: 7.5% defective is beyond the upper control limit of 6.6%, so that day's production should be investigated. Attribute charts need large samples to detect changes, because each item carries little information; measuring the dimension behind a pass/fail decision is usually far more informative.

Process capability

A process in control is predictable, but it may still not meet its specification. Capability indices compare the process spread with the tolerance between the lower and upper specification limits (LSL and USL):

\[C_p = \frac{USL - LSL}{6\sigma}, \qquad C_{pk} = \min\left(\frac{USL - \mu}{3\sigma}, \frac{\mu - LSL}{3\sigma}\right)\]

\(C_p\) measures potential capability if the process were centred; \(C_{pk}\) accounts for where the mean actually is, and is the one that predicts defects. A centred process with \(C_p = 1\) produces about 0.27% out of specification (2700 parts per million); \(C_{pk} = 1.33\) corresponds to about 63 ppm, and many industries require at least 1.33 for existing processes and 1.67 for new or safety-critical ones. "Six sigma" quality corresponds to \(C_p = 2\).

Worked problem

Is the shaft process capable?

For the shaft process (mean 25.002 mm, σ = 0.0052 mm), the specification is 25.000 ± 0.025 mm. Find \(C_p\) and \(C_{pk}\).

Show solution
  1. \(C_p = 0.050/(6 \times 0.0052) = 1.60\).
  2. \(C_{pk} = \min(0.023, 0.027)/(3 \times 0.0052) = 0.023/0.0156 = 1.47\).

Answer: Cp = 1.60 and Cpk = 1.47: capable, with the slight off-centring costing a little capability. Recentring the process would bring Cpk up to Cp. Capability indices are meaningful only for a process in statistical control, measured with an adequate gauge (Lesson 2), and their estimates from small samples are uncertain.

Three normal distributions drawn against the same lower and upper specification limits. The first, with Cp of 1.6 and centred, fits well inside the limits. The second has the same spread but is shifted toward the upper limit, so its Cpk is lower and a small tail falls outside. The third is wide, with Cp of 0.8, and large tails fall outside both limits.
Capability: spread relative to the tolerance (Cp) and position within it (Cpk).

Acceptance sampling

When a lot of purchased parts arrives, inspecting every item may be too costly or, for destructive tests, impossible. A single sampling plan inspects a random sample of n items and accepts the lot if it contains at most c defectives. The plan's operating characteristic (OC) curve gives the probability of acceptance as a function of the lot's true fraction defective p, computed from the binomial distribution:

\[P(\text{accept}) = \sum_{x=0}^{c}\binom{n}{x}p^x(1 - p)^{n - x}\]

Worked problem

An incoming inspection plan

A plan inspects n = 50 items and accepts the lot if c ≤ 1 defectives are found. Find the probability of accepting lots that are 2% and 5% defective.

Show solution
  1. p = 0.02: \(0.98^{50} + 50(0.02)(0.98^{49}) = 0.364 + 0.372 = 0.736\).
  2. p = 0.05: \(0.95^{50} + 50(0.05)(0.95^{49}) = 0.077 + 0.202 = 0.279\).

Answer: A 2%-defective lot is accepted 74% of the time, and a 5%-defective lot still 28% of the time. Small samples discriminate poorly between good and bad lots, which is why the OC curve should be examined before adopting any plan, and why modern quality practice prefers controlling the supplier's process (with control charts and capability evidence) to inspecting quality in at the receiving dock.

Operating characteristic curves showing probability of accepting a lot against lot fraction defective from 0 to 15 percent, for plans with n of 50 and c of 1, and n of 200 and c of 4. Both curves start at 1 and fall; the larger plan falls much more steeply, discriminating better between good and bad lots. Points mark acceptance probabilities of 0.74 at 2 percent and 0.28 at 5 percent for the smaller plan.
OC curves: a larger sample discriminates more sharply between good and bad lots.

Common mistakes

  • MistakeUsing specification limits as control limits.

    InsteadControl limits come from the process data; specifications come from requirements.

  • MistakeAdjusting the process after every reading within the limits.

    InsteadTampering increases variation; act only on signals.

  • MistakeComputing capability for a process that is not in control.

    InsteadBring the process into control first; capability assumes stability.

  • MistakeReporting Cp when the process is off-centre.

    InsteadCpk reflects the actual mean position and predicts defects.

  • MistakeAssuming a sampling plan reliably rejects bad lots.

    InsteadCheck its OC curve; small samples accept many poor lots.

Summary and key terms

  • Common-cause variation is inherent; special causes are specific and removable.
  • X̄ and R charts use limits x̿ ± A₂R̄ and D₃R̄ to D₄R̄; σ is estimated by R̄/d₂.
  • Points beyond 3σ limits and run rules such as eight points on one side signal special causes.
  • p charts use p̄ ± 3√(p̄(1 − p̄)/n); c charts use c̄ ± 3√c̄.
  • Cp = (USL − LSL)/6σ measures potential capability; Cpk includes centring and predicts defects.
  • Cpk ≥ 1.33 is a common requirement; capability needs a stable process and a good gauge.
  • Acceptance sampling plans are judged by their OC curves.
Common-cause variation
Variation inherent in a stable process.
Special-cause variation
Variation from a specific, identifiable event.
Statistical control
A state in which only common-cause variation is present.
Control chart
A time plot of a process statistic with control limits.
Rational subgroup
A small sample of consecutive items used to estimate short-term variation.
Average run length
The average number of samples before a control chart signals.
p chart
A control chart for the fraction defective.
Process capability
The ability of a stable process to meet its specification.
Cpk
A capability index accounting for both spread and centring.
Operating characteristic curve
The probability of accepting a lot as a function of its quality.
Tampering
Adjusting a stable process in response to common-cause variation.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Subgroups of 5 give x̿ = 50.0 and R̄ = 2.0. Find the X̄ chart limits.

    Show answer

    50.0 ± 0.577 × 2.0 = 48.85 to 51.15.

  2. Find the R chart limits for that process.

    Show answer

    0 to 2.114 × 2.0 = 4.23.

  3. Estimate σ for that process.

    Show answer

    2.0/2.326 = 0.86.

  4. What is the false-alarm probability per point for 3σ limits on a stable normal process?

    Show answer

    About 0.0027, an ARL of 370.

  5. Find p chart limits for p̄ = 0.05 and n = 100.

    Show answer

    0.05 ± 0.065: 0 to 0.115.

  6. Find c chart limits for an average of 9 defects per unit.

    Show answer

    9 ± 9: 0 to 18.

  7. A process has σ = 0.002 mm and a tolerance of ±0.008 mm. Find Cp.

    Show answer

    0.016/0.012 = 1.33.

  8. If that process mean sits 0.002 mm above nominal, find Cpk.

    Show answer

    0.006/0.006 = 1.0.

  9. For the plan n = 50, c = 1, find P(accept) for a 1%-defective lot.

    Show answer

    0.99⁵⁰ + 50(0.01)(0.99⁴⁹) = 0.605 + 0.306 = 0.911.

  10. Why is tampering harmful?

    Show answer

    Adjusting for random variation adds the adjustment error to the natural variation, increasing spread.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz