Guides / process control
Statistical process control and control charts
A control chart answers one question: is this process behaving normally, or has something changed? Getting it wrong in either direction is costly. React to ordinary variation and you make a stable process worse. Miss a genuine shift and you ship the problem. This guide builds a chart from raw numbers, shows a real shift that never breaches a control limit, and separates control limits from specification limits, which are confused constantly.
A method for telling routine variation apart from a genuine change. Every process varies; the question is whether today's number is ordinary noise or a signal. SPC plots measurements over time against limits calculated from the process's own short-term variation, usually three sigma either side of the mean. Points inside the limits with no unusual pattern mean the process is stable and should be left alone. Points outside, or patterns that are unlikely by chance, mean something has changed and is worth investigating.
The worked capability numbers
Take the process from the worked example with specification limits of 42 and 50, a mean of 47.2 and a within-process sigma of 0.80.
Cp = (USL − LSL) / 6σ = (50 − 42) / (6 × 0.80) = 8 / 4.80 = 1.667
That looks healthy. Cp asks only whether the spread would fit, and says nothing about where the process is sitting. Now account for position.
Cpu = (USL − μ) / 3σ = (50 − 47.2) / 2.40 = 1.167
Cpl = (μ − LSL) / 3σ = (47.2 − 42) / 2.40 = 2.167
Cpk = min(1.167, 2.167) = 1.167
What the gap between Cp and Cpk is worth
Cp 1.667 against Cpk 1.167 means the variation is fine and the centring is not. Converting to expected defect rates under normality:
| Process mean | Cp | Cpk | Expected out of specification |
|---|---|---|---|
| 47.2, as observed | 1.667 | 1.167 | 233 per million |
| 46.0, centred | 1.667 | 1.667 | 0.6 per million |
Moving the mean 1.2 units, with no reduction in variation at all, cuts the expected defect rate by a factor of about 400. The whole loss is in the centring, and centring is normally the cheaper of the two things to fix.
This is why Cp should never be reported alone. A process can show an impressive Cp and still produce scrap, and the pair together tells you which problem you have: a low Cp means reduce variation, while a healthy Cp with a low Cpk means move the mean.
The core distinction
Common cause and special cause
Everything in the method rests on one separation.
| Common cause | Special cause | |
|---|---|---|
| What it is | The ordinary variation built into how the process works | Something that was not there before |
| Pattern | Random, stable, predictable in range | A spike, a shift, a trend, a change in spread |
| Correct response | Leave it alone. Change the system if you want a different average. | Investigate. Find the cause and remove or standardise it. |
| Cost of getting it wrong | Tampering. Reacting to noise adds variation. | Missing a real problem. |
Tampering is the expensive one and the more common. A manager seeing a figure dip below last month's and demanding an explanation is asking a team to account for randomness. The team will supply an explanation, because people always can, and the organisation will act on it.
"Why was this month worse than last month?" is almost always the wrong question, because it assumes the difference means something. "Is this process stable?" is answerable, and it has to be answered first.
Choosing
Choosing the right chart
The chart follows from what you are measuring and how the data arrives.
| Data | Chart | Typical use |
|---|---|---|
| One measurement per period | I-MR (individuals and moving range) | Daily turnaround time, monthly cost per case |
| Small subgroups, n of 2 to 9 | X-bar and R | Five samples per shift |
| Larger subgroups, n of 10 or more | X-bar and S | Large regular batches |
| Proportion defective, varying sample size | p chart | Monthly complaint rate |
| Count of events, constant opportunity | c chart | Incidents per month |
| Count per unit, varying opportunity | u chart | Falls per 1,000 bed days |
I-MR is the workhorse in service settings because most operational data arrives one figure at a time. In healthcare improvement the p, c and u charts dominate, because the outcome is a rate and the denominator moves.
Worked example one
Building an I-MR chart
Twenty days of turnaround time in hours.
days 1–10: 41 42 40 43 41 42 41 43 42 41
days 11–20: 46 47 45 48 46 47 49 46 48 47
Step 1. The centre line
mean of all 20 = 44.25 hours
Step 2. The moving ranges
Take the absolute difference between each consecutive pair. Nineteen of them from twenty points.
mean moving range (MR̄) = 1.895
Step 3. Sigma, estimated the SPC way
This is the step that separates SPC from ordinary descriptive statistics, and it is the one most often done wrongly.
sigma = MR̄ / d₂ = 1.895 / 1.128 = 1.680
The constant 1.128 is d₂ for a moving range of two points. The reason for using moving ranges rather than the standard deviation of all the data is that consecutive differences capture short-term variation only. Anything that drifts across the series does not inflate them.
Step 4. The limits
UCL = 44.25 + 3 × 1.680 = 49.29
LCL = 44.25 − 3 × 1.680 = 39.21
Step 5. The comparison that reveals the problem
The ordinary standard deviation of all twenty values is 2.918. The short-term sigma is 1.680. The overall spread is 1.74 times the short-term variation.
That gap is not a nuisance. It is the finding. If a process were stable, the two would be close. When overall variation substantially exceeds short-term variation, something is moving the process between observations.
Worked example two
The shift the limits missed
Look again at the two halves of that data. The first ten days average around 41.6 hours. The last ten average around 46.9. The process clearly changed.
Now check the points against the limits
UCL is 49.29. The highest observation is 49. Not a single point breaches a control limit.
A chart read only for limit breaches would report this process as in control, and the five-hour deterioration would run indefinitely.
What catches it
The centre line is 44.25. Every one of the last ten points sits above it, and every one of the first ten sits below.
longest run on one side of the centre line = 10
Nelson's rule 2 signals at nine consecutive points on one side. This triggers comfortably.
Three sigma limits are tuned to catch large sudden spikes. They are poor at detecting small sustained shifts, which is exactly the pattern most service processes produce when something degrades gradually. A chart without run rules will miss the shifts that matter most, and will do so quietly.
The trap that would have hidden it completely
Suppose you had drawn the limits using the overall standard deviation of 2.918 instead of the short-term sigma.
wrong limits: 44.25 ± 3 × 2.918 = 35.50 to 53.00
Wider still, and certain to hide the shift, because the shift itself inflated the standard deviation that drew the limits. The bigger the change, the wider the limits become, and the less likely the chart is to flag it. This is the single most damaging error in applied SPC.
Pattern detection
Run rules, and why they exist
Run rules look for patterns that are improbable in a stable process even when no point escapes the limits. Nelson's set is the common one; Western Electric's is similar.
| Rule | Signal | Usually indicates |
|---|---|---|
| 1 | One point beyond three sigma | A spike or one-off event |
| 2 | Nine in a row on one side of the centre | A sustained shift |
| 3 | Six in a row steadily increasing or decreasing | A trend, such as drift or wear |
| 4 | Fourteen alternating up and down | Over-adjustment, often tampering |
| 5 | Two of three beyond two sigma, same side | An emerging shift |
| 6 | Four of five beyond one sigma, same side | A smaller sustained shift |
Rules 1, 2 and 3 do most of the useful work. Adding all eight raises sensitivity and also raises false alarms, which is a trade worth making deliberately rather than by default.
The cost of looking
The false alarm arithmetic
A three sigma limit on normally distributed data gives a 0.27% chance that any single point falls outside by chance alone. That sounds negligible until you plot a series.
| Points charted | Chance of at least one false signal |
|---|---|
| 20 | 5.3% |
| 50 | 12.6% |
| 100 | 23.7% |
| 250 | 49.1% |
Chart a daily measure for a year and it is close to a coin toss whether you will investigate at least one point that was never a problem. This is the same multiplicity logic that governs multiple comparisons: every extra look is another chance to be fooled.
That is not an argument against charting. It is an argument for expecting the occasional false signal, investigating proportionately, and not treating every breach as proof that something is broken.
A constant confusion
Control limits are not specification limits
These get drawn on the same chart and treated as the same kind of line. They are entirely different things.
| Control limits | Specification limits | |
|---|---|---|
| Where they come from | The process itself, from its own variation | A customer, a contract, a regulator |
| What they tell you | Whether the process is stable | Whether output is acceptable |
| Can you change them? | Only by changing the process | By negotiation |
| On the chart | Always | Never |
Putting specification limits on a control chart invites the operator to adjust whenever a point approaches the spec, which is tampering, and it is how a stable process gets made worse.
A process can be perfectly in control and entirely incapable of meeting the specification. It can also be wildly out of control while every unit happens to pass. Stability and acceptability are separate questions, and you need both answers.
Meeting the spec
Capability: Cp and Cpk
Once a process is stable, and only then, you can ask whether it is capable. Take the same process, with sigma 1.680 and a mean of 44.25, against a specification of 35 to 50 hours.
Cp = (USL − LSL) / 6σ = (50 − 35) / (6 × 1.680) = 1.488
Cp asks whether the spread would fit inside the specification if the process were centred. At 1.488 there is comfortable room.
Cpu = (50 − 44.25) / (3 × 1.680) = 1.141
Cpl = (44.25 − 35) / (3 × 1.680) = 1.835
Cpk = min(Cpu, Cpl) = 1.141
Cpk accounts for where the process actually sits. The gap between Cp 1.488 and Cpk 1.141 says the process is off-centre, sitting closer to the upper limit than the lower one. Recentring it, with no reduction in variation at all, would lift Cpk to 1.488.
At Cpk 1.141 roughly 310 units per million would fall beyond the nearer specification limit, assuming normality. Common thresholds are 1.33 as a minimum and 1.67 for critical characteristics.
Cp and Cpk describe a process that will keep behaving as it did. If the chart shows special causes, the process has no single sigma and no fixed mean, so there is nothing for the index to describe. Stability first, capability second. Reversing the order produces a confident number about a process that does not exist.
Doing it
In R, SPSS and Stata
R
The qcc package handles every chart type and applies run rules automatically.
library(qcc)
qcc(x, type = "xbar.one")
qcc(defects, sizes = n, type = "p")
process.capability(qcc(x, type = "xbar.one", plot = FALSE), spec.limits = c(35, 50))
type = "xbar.one" is the individuals chart and uses the moving range estimate by default, which is what you want. For healthcare-style charts with varying denominators, qicharts2::qic(y, n = denominator, chart = "u") is purpose-built and produces run-rule signals in the standard improvement format.
SPSS
Control charts are under Analyze, Quality Control, Control Charts.
SPCHART /XR = turnaround BY day
/STATISTICS = CP CPK
/RULES = ALL
/SPECIFICATION = LOWER(35) UPPER(50).
/RULES = ALL applies the Western Electric set; without it SPSS checks limit breaches only and will miss the sustained shift in the example above. For an individuals chart specify /I = variable.
Stata
No native SPC suite, but the user-written commands are good.
ssc install qcchart
qcchart turnaround day, individual
ssc install pchart
Alternatively compute it directly, which is transparent and only a few lines: generate the moving range with gen mr = abs(x - x[_n-1]), take summarize mr, divide the mean by 1.128 and build the limits from there.
Some tools default to the overall standard deviation rather than the moving range. The chart looks the same and the limits are wrong, usually too wide, and widest exactly when the process has shifted. Confirm the method before trusting any chart you did not build yourself.
Avoid these
Six mistakes that cost you money
| Mistake | Why it matters |
|---|---|
| Using the overall SD for the limits | A shift inflates the SD, which widens the limits, which hides the shift. The worse the problem, the better the chart looks. |
| Charting limits without run rules | The worked example shifted five hours and never breached a limit. Rule 2 caught it; limits alone did not. |
| Drawing specification limits on the chart | Encourages adjustment toward the spec, which is tampering and adds variation. |
| Recalculating limits every period | Limits should be fixed from a stable baseline. Recomputing them lets the process drift inside its own moving goalposts. |
| Reporting Cpk on an unstable process | There is no single sigma to describe. The index is a confident number about a process that does not exist. |
| Investigating every signal equally | Over 100 points there is a 24% chance of a false alarm. Expect some, and respond proportionately. |
Adjusting a stable process on a single point makes it worse, and the usual cause is limits drawn from the overall standard deviation rather than the short-term one. Send the data and you get charts built correctly, with the rules that apply to them.
See statistical consultancy
Saad TariqPrincipal StatisticianWriting it up
How to report it
Common questions
Frequently asked questions
What is a control chart?
A plot of a measurement over time with a centre line and limits calculated from the process's own short-term variation, normally three sigma either side of the mean. Points inside the limits with no unusual pattern indicate a stable process. Points outside, or improbable patterns, indicate something has changed.
How do you calculate control limits?
For an individuals chart, take the mean of the moving ranges between consecutive points, divide by the constant 1.128 to get sigma, then set the limits three sigma either side of the mean. With a mean moving range of 1.895 the sigma is 1.680, giving limits of 39.21 and 49.29 around a mean of 44.25.
Why not just use the standard deviation?
Because the standard deviation of all the data includes any shift or drift within it. A process that moves inflates its own standard deviation, which widens the limits, which hides the movement. Moving ranges capture only short-term variation, so a shift shows up instead of being absorbed.
What is the difference between control limits and specification limits?
Control limits come from the process and tell you whether it is stable. Specification limits come from a customer or regulator and tell you whether output is acceptable. They are different questions, and specification limits should never be drawn on a control chart because it encourages adjustment toward the spec.
Do I need run rules?
Yes, for anything other than large sudden spikes. In the worked example the process shifted by five hours and not one point crossed a limit; the run of ten consecutive points on one side of the centre line is what caught it. Rules 1, 2 and 3 do most of the useful work.
What is a good Cpk?
1.33 is a common minimum and 1.67 is typical for critical characteristics. Always report Cp alongside it: a Cp of 1.488 with a Cpk of 1.141 means the spread would fit comfortably but the process is off-centre, and recentring alone would fix it without reducing variation at all.
How often should I recalculate the limits?
Rarely. Fix them from a stable baseline period and leave them. Recalculating each period lets a drifting process carry its own limits along with it, so a gradual deterioration never signals. Recalculate only after a deliberate, documented change to the process.
Related services
If the findings have to persuade a board
Survey and insight analysis
Survey data analysed and reported so the findings hold up to scrutiny.
Fixed quoteStatistical consultancy
Design, analysis and reporting for charities, universities, the NHS and business.
From £950Data cleaning & preparation
Messy data made analysis-ready, with a documented log of every change.
Fixed quoteEvery piece of work is done and signed by a named statistician. Send the data or describe the project and you get a price and a deadline, usually within one working day.