What statistical process control is
Statistical process control (SPC) starts from an idea Walter Shewhart had in the 1920s: every process varies, but there is normal variation, made of many small causes that are always present, and special variation, due to a specific cause such as a worn tool, a different batch of material or a wrong setting. The control chart is there to tell them apart.
As long as the points stay within the limits and form no unusual patterns, the process is said to be in control: it varies only from common causes, and intervening would make things worse. When a point falls outside or a rule fires, there is a special cause to look for. Note: control limits come from the process, tolerance limits from the drawing. They are two different things and must never be confused.
X̄-R chart: when to use it
The X̄-R chart is used for continuous measurements (weights, dimensions, temperatures, torques) collected in rational subgroups: a few consecutive parts, made under the same conditions, measured at regular intervals. For example, five bottles weighed every fifteen minutes.
- X̄-R for subgroups of 2 to about 10 parts: the range R (maximum minus minimum) is simple and estimates variation well.
- X̄-S for larger subgroups, above 10: the subgroup standard deviation is more efficient than the range.
- I-MR (individuals and moving range) when each measurement stands alone, for example one lab analysis per batch.
- Attribute charts when you count rather than measure: defective parts or defects.
Calculating the limits
Start from a reference period in which the process is stable, at least 20–25 subgroups. For each subgroup calculate the mean X̄ and the range R; then the grand mean X̄̄ and the average range R̄. The 3σ limits are obtained with tabulated constants that depend only on the subgroup size n.
X̄ chart: CL = X̄̄ UCL = X̄̄ + A2 × R̄ LCL = X̄̄ − A2 × R̄
R chart: CL = R̄ UCL = D4 × R̄ LCL = D3 × R̄
Estimate of the process standard deviation: σ = R̄ ÷ d2
| n | A2 | D3 | D4 | d2 |
|---|---|---|---|---|
| 2 | 1.880 | 0 | 3.267 | 1.128 |
| 3 | 1.023 | 0 | 2.574 | 1.693 |
| 4 | 0.729 | 0 | 2.282 | 2.059 |
| 5 | 0.577 | 0 | 2.114 | 2.326 |
| 6 | 0.483 | 0 | 2.004 | 2.534 |
| 7 | 0.419 | 0.076 | 1.924 | 2.704 |
| 8 | 0.373 | 0.136 | 1.864 | 2.847 |
| 9 | 0.337 | 0.184 | 1.816 | 2.970 |
| 10 | 0.308 | 0.223 | 1.777 | 3.078 |
The limits are calculated once on the reference period and then held fixed: recalculating them at every new point widens them exactly when the process shifts, and the chart stops warning you. Recalculate them after an intended and verified change to the process.
The Western Electric (and Nelson) rules
A point beyond the limits is not the only signal. The Western Electric rules, published in the company's quality control handbook in 1956, divide the chart into three zones on each side (within 1σ, between 1σ and 2σ, between 2σ and 3σ) and look for patterns that a stable process would produce very rarely. Here σ is the standard deviation of the subgroup mean, that is one third of the distance between the center line and the limit.
| Rule | Signal | What it usually indicates |
|---|---|---|
| 1 | One point beyond 3σ | A sudden special cause: measurement error, an abnormal part, a breakdown |
| 2 | Two out of three consecutive points beyond 2σ, on the same side | A shift in the mean that is starting |
| 3 | Four out of five consecutive points beyond 1σ, on the same side | A small but persistent shift |
| 4 | Eight consecutive points on the same side of the center line | A change in level: a new batch, a new setting |
The Nelson rules (1984) are eight and include the previous four, with nine points instead of eight for the same-side rule, plus four patterns: six points in a row steadily increasing or decreasing (drift, typical of wear), fourteen points in a row alternating up and down (overadjustment), fifteen points in a row within 1σ (limits too wide or mixed data) and eight points in a row beyond 1σ on either side (two mixed populations). The more rules you turn on, the more false alarms you get: choose one set and keep it the same for every line.
Worked example
A filler doses 500 g bottles. Every fifteen minutes five consecutive bottles are weighed (n = 5). Over the 25 subgroups of the reference period the grand mean is X̄̄ = 500.20 g and the average range is R̄ = 1.10 g.
X̄ chart limits: 500.20 ± 0.577 × 1.10 = 500.20 ± 0.63, that is UCL = 500.83 g and LCL = 499.57 g. R chart limits: UCL = 2.114 × 1.10 = 2.33 g, LCL = 0. The estimated process standard deviation is 1.10 ÷ 2.326 = 0.47 g. The zones of the X̄ chart fall every 0.21 g: 500.41, 500.62 and 500.83 above the center line.
| Subgroup | X̄ (g) | R (g) | Zone | Rule |
|---|---|---|---|---|
| 26 | 500.31 | 0.9 | within 1σ | — |
| 27 | 500.45 | 1.2 | between 1σ and 2σ | — |
| 28 | 500.52 | 1.0 | between 1σ and 2σ | — |
| 29 | 500.58 | 1.3 | between 1σ and 2σ | — |
| 30 | 500.66 | 1.1 | between 2σ and 3σ | 3: four out of five beyond 1σ |
| 31 | 500.71 | 1.0 | between 2σ and 3σ | 2: two out of three beyond 2σ |
With a tolerance of ±3 g on the nominal weight, no bottle is out of specification yet: the chart warns you while there is still time to look for the cause, for example a nozzle that is wearing out. Once stable, the same process is assessed with the capability indices Cp and Cpk.
Attribute charts: p, np, c, u
When the outcome is good or defective, or you count defects, you use attribute charts. The 3σ limits come from the binomial (defectives) and Poisson (defects) distributions.
| Chart | What it tracks | Sample | Limits |
|---|---|---|---|
| p | Fraction of defective parts | May vary | p̄ ± 3 √(p̄(1 − p̄) ÷ n) |
| np | Number of defective parts | Constant | np̄ ± 3 √(np̄(1 − p̄)) |
| c | Number of defects | Constant inspection unit | c̄ ± 3 √c̄ |
| u | Defects per unit | May vary | ū ± 3 √(ū ÷ n) |
From the chart in Excel to the alarm on the line
A chart kept by hand or in a spreadsheet always arrives late: the measurements are copied over at the end of the shift and the drift is discovered when the shift is over. The value of the chart lies in seeing it while the process changes.
With Muvia Industrial the measurements arrive from the checkweigher or the measuring machine through the edge node, for example over OPC UA, with their timestamp and their subgroup. A Python function written by your team calculates means, ranges, limits from the reference period and the Western Electric rules; a flow runs it at every shift change and a threshold on the violated-rules column opens an episode in the alarm register. This is the path of the use case The control chart that warns you first; for critical stamping dimensions and Cpk per die there is the use case The critical dimension that drifts before the first scrap.
Frequently asked questions
X̄ chart: X̄̄ ± A2 × R̄. R chart: upper limit D4 × R̄, lower limit D3 × R̄. The constants depend on the subgroup size: for n = 5 they are A2 = 0.577, D3 = 0 and D4 = 2.114.
Control limits come from the process and tell you whether it varies only from common causes. Tolerance limits come from the drawing or the customer and tell you whether the part is acceptable. A process can be in control and produce scrap, or out of control with every part good.
One point beyond 3σ; two out of three consecutive points beyond 2σ on the same side; four out of five consecutive points beyond 1σ on the same side; eight consecutive points on the same side of the center line.
Only after an intended and verified change to the process, on a new stable reference period of at least 20–25 subgroups. Recalculating them continuously makes them follow the drift, and the chart stops flagging it.
When the check gives a good or defective outcome instead of a measurement. The p chart tracks the fraction defective even with samples of variable size; with a continuous measurement the X̄-R chart is much more sensitive.