Sub topic 9
Control charts: separating signal from noise
This chapter assumes you can compute a mean and a sample standard deviation. It also assumes you know the difference between common-cause and special-cause variation from earlier chapters, and that you have a rough picture of the normal distribution. You will build an individuals control chart in Python, read it, and learn the mistakes that make charts misleading.
The problem a control chart solves
Every process produces values that wobble. Each new measurement forces a decision: is this wobble ordinary noise, or has something changed? If you react to noise, you waste effort and can make the process worse. If you ignore a real change, defects build up unnoticed.
A control chart answers the question with a rule. It plots measurements in time order and adds three horizontal lines:
- The center line is the process average.
- The upper control limit (UCL) sits three estimated standard deviations above the center line.
- The lower control limit (LCL) sits three estimated standard deviations below it.
A point inside the limits is consistent with common-cause variation. A point outside them is a signal: it is unlikely enough under routine noise that it is worth looking for a special cause.
Why three sigma
If a process is stable and roughly normal, about 99.73% of values fall within three standard deviations of the mean. A stable process therefore puts a point outside the limits about 0.27% of the time, roughly 1 point in 370.
This is a trade-off, not a law of nature. Tighter limits, such as two sigma, catch shifts sooner but raise false alarms to about 1 in 22 points. Wider limits give fewer false alarms but react more slowly. Three sigma is the conventional compromise, and Walter Shewhart chose it for economic reasons, not because it is mathematically optimal.
Control limits are not specification limits
This is the most common confusion about control charts.
- Control limits come from the process data. They describe what the process actually does, the "voice of the process."
- Specification limits come from the customer or the design. They describe what the process should do, the "voice of the customer."
Comparing the process spread to the specification is a separate step, called capability analysis. A chart comes first, because capability numbers are only meaningful for a stable process.
Building an individuals chart
An individuals chart (also called an I-chart or X chart) is used when you have one measurement per time period, for example one shaft diameter per sample, or one invoice cycle time per day.
The tricky part is estimating sigma. You might compute the ordinary standard deviation of all the data. That is risky, because if the data already contains a shift or an outlier, the standard deviation is inflated, and the limits widen enough to hide the very problem you want to see.
The standard approach uses the moving range, the absolute difference between consecutive points. Consecutive points are close together in time, so their differences mostly reflect short-term noise and not long-term drift. The estimate is:
sigma-hat = (average moving range) / 1.128
The constant 1.128 is d2 for subgroups of size 2. It converts an average range of two values into an estimate of the standard deviation.
from statistics import mean
def individuals_chart_limits(data):
# Estimate sigma from the average moving range; 1.128 is the d2 constant for subgroups of size 2.
moving_ranges = [abs(b - a) for a, b in zip(data, data[1:])]
sigma_hat = mean(moving_ranges) / 1.128
center = mean(data)
return center - 3 * sigma_hat, center, center + 3 * sigma_hat
def out_of_control_points(data, limits=None):
lcl, _, ucl = limits or individuals_chart_limits(data)
return [(i, x) for i, x in enumerate(data) if x < lcl or x > ucl]
# Baseline: ten shaft diameters (mm) from a period believed to be stable
baseline = [10.02, 9.98, 10.05, 9.97, 10.01, 10.03, 9.99, 10.00, 10.04, 9.96]
limits = individuals_chart_limits(baseline)
print("LCL, center, UCL:", [round(v, 3) for v in limits])
print("baseline signals:", out_of_control_points(baseline, limits))
# New production data, judged against the baseline limits
new_data = [10.01, 10.03, 10.20, 10.00]
print("new signals:", out_of_control_points(new_data, limits))Working through the numbers by hand shows what the code does:
- The nine moving ranges of the baseline are 0.04, 0.07, 0.08, 0.04, 0.02, 0.04, 0.01, 0.04 and 0.08. They sum to 0.42, so the average moving range is 0.0467.
- Dividing by 1.128 gives sigma-hat of about 0.0414.
- The mean is 10.005, so the limits are 10.005 ± 0.124. That is an LCL near 9.881 and a UCL near 10.129.
The program prints those limits, reports no signals in the baseline, and flags index 2 of the new data (10.20), which lies above the UCL.
Reading the chart: more than one rule
A point beyond the limits is the strongest signal, but not the only one. A process can drift slowly without any single point leaving the limits. Common supplementary rules, often called Western Electric or Nelson rules, include:
| Pattern | What it suggests |
|---|---|
| One point beyond three sigma | A sudden event, such as a tool break, a wrong material lot, or a data entry error |
| Eight or more points in a row on one side of the center line | A sustained shift in the mean |
| Six points in a row steadily rising or falling | A trend, such as tool wear or a drifting temperature |
| Fourteen points alternating up and down | Two alternating sources mixed together, such as two machines or two shifts |
| Points hugging the center line far more tightly than expected | Over-grouped data, or limits computed from mixed streams |
Each added rule catches more real problems and also raises the overall false-alarm rate. Pick a small set and apply it consistently.
Here is a check for the run rule:
def run_signals(data, center, run_length=8):
"""Return indices where a run of run_length or more points on one side of center is reached."""
signals = []
run = 0
side = 0
for i, x in enumerate(data):
s = 1 if x > center else -1 if x < center else 0
if s != 0 and s == side:
run += 1
else:
run = 1 if s != 0 else 0
side = s
if run >= run_length:
signals.append(i)
return signals
center = 10.005
shifted = [10.03, 10.02, 10.04, 10.01, 10.03, 10.02, 10.05, 10.02, 10.03]
print(run_signals(shifted, center)) # [7, 8]Every value in shifted is inside the limits of 9.881 to 10.129. A limits-only check would find nothing. The run rule fires on the eighth point, because nine consecutive points above the center line are very unlikely if the mean has not moved. Under a stable process, each point is above the line with probability about one half, so eight in a row has probability (1/2)^8, about 0.4%.
A decision flow for each new point
The two "yes" and "no" branches call for different responses. A signal calls for a search for a specific cause tied to a time and an event. A stable chart that still produces defects calls for a change to the process itself, such as a different machine, material or method, because no single event is responsible. This is the link to DMAIC later in the course.
Common errors
- Computing limits from the wrong data. If the baseline contains special causes, the limits are distorted. Plot the baseline first, investigate signals, remove those points only when you have found and fixed the cause, and then compute limits.
- Using too little baseline data. With ten points, the limits are rough. Practitioners often want 20 to 25 points before trusting them. The ten-point example here is for learning.
- Shuffling the order. A control chart depends on time order. Sorting or averaging the data destroys the patterns the rules look for.
- Ignoring measurement error. A gauge that varies a lot adds noise that looks like process variation. Check the measurement system before charting.
- Reacting to every wiggle. Adjusting the process after each point that is merely above or below target adds variation. The next chapter covers this over-adjustment, called tampering.
- Assuming normality is essential. The three-sigma limits work reasonably well for moderately skewed data. For strongly skewed data, such as waiting times, consider transforming the data or using a chart designed for it.
Exercise
A stable process has a baseline mean of 50.0 and an average moving range of 1.128. Compute the control limits for an individuals chart. Then say whether a new value of 53.5 is a signal, and whether a customer upper specification limit of 54 changes your answer.
Show answer
Sigma-hat = 1.128 / 1.128 = 1.0. The limits are 50.0 ± 3(1.0), so LCL = 47.0 and UCL = 53.0. The value 53.5 is above the UCL, so it is a signal of a possible special cause and should be investigated. The specification limit of 54 does not change this. The value is still within specification, but control limits describe process behavior, not customer requirements. The point is a warning that something has changed, even though the part is not yet a defect.
Exercise
Twelve consecutive points all fall between the center line and the UCL, and none is beyond the limits. Is the process in control? Explain which rule applies and why.
Show answer
No. Twelve points in a row on one side of the center line breaks the run rule (eight or more). If the process were stable and centered, each point would be above the line with probability about one half, so the chance of twelve in a row is (1/2)^12, about 0.02%. This pattern suggests the mean has shifted upward, so you should look for a special cause even though no single point left the limits.