---
name: statistical_process_control
description: "Run statistical process control on a real process: pick the right control chart for the data type, form rational subgroups, calculate control limits from a stable Phase I baseline, apply out of control rules in a fixed order, read process capability (Cp, Cpk, Pp, Ppk) with its limits, and run a written reaction plan when a signal fires. Use when setting up SPC, choosing between X-bar and R, X-bar and S, I-MR, p, np, c, and u charts, computing or checking control limits, judging whether a process is stable or capable, or deciding what to do about a control chart signal."
---

# Statistical Process Control

## Purpose

Put one process characteristic under statistical control and keep it there: separate common cause variation, which belongs to the process and needs a process change to reduce, from special cause variation, which arrived at a specific time and can be found and removed. The skill runs the full loop in order, chart selection, rational subgrouping, a Phase I baseline, Phase II monitoring against fixed limits, capability only after stability, and a reaction plan that starts at the first signal. Formulas and constants are in `references/formulas-and-constants.md`, chart selection is worked as a worksheet in `references/chart-selection.md`, and a complete chart with a signal and a reaction is worked end to end in `references/worked-example.md`.

## Workflow

1. **Pick one characteristic and define it tightly.** Name the characteristic, the unit, the specification if one exists, and how and where it is measured. Charting five characteristics badly helps nobody. Start with the one that drives scrap, rework, or customer complaints.
2. **Check the measurement system before charting anything.** If the gauge cannot tell conforming from nonconforming product, or two operators get different readings on the same part, the chart will plot measurement noise and every later step is wasted. Run a gauge repeatability and reproducibility check or a simple bias and repeatability check first, and fix measurement problems before collecting baseline data.
3. **Select the chart from the data, not from habit.** Work `references/chart-selection.md` in order. Measured data in subgroups of 2 to 10 takes X-bar and R, subgroups over 10 take X-bar and S, one reading at a time takes I-MR. Counted defective units take p when the sample size varies and np when it is constant. Counted defects take c when the area of opportunity is constant and u when it varies. Settle whether you are counting defectives or defects before anything else, because that one word picks the chart family.
4. **Form rational subgroups.** A subgroup is a small set of units made under conditions as alike as possible, usually consecutive units. Within subgroup variation should show only common causes, so it can estimate the short term variation that sets the limit width. Sample often enough that a shift shows up while the suspect product is still findable. Keep subgroup size constant for variables charts. Never build a subgroup out of units from two machines, two shifts, or two lots, and never mix streams on one chart.
5. **Run Phase I and earn the baseline.** Collect at least 20 to 25 subgroups before calculating trial limits (for individuals charts, at least 30 readings is a common floor, and more is better). Run `bin/spc.py` for the chart type. Read the dispersion chart (R, S, or MR) before the location chart: if variation itself is unstable, the location limits built on it mean little. Investigate every out of control point. Remove a point from the baseline only when an assignable cause was actually found, and record what it was. Recalculate and repeat until the baseline plots in control. A baseline built from an unstable process produces limits that excuse the very signals the chart exists to catch.
6. **Freeze the limits and write the reaction plan.** Adopt the Phase I center line and limits as fixed monitoring limits. Fill in `assets/reaction-plan-template.md` for the characteristic: containment, who responds, the measurement check that runs first, the short list of likely changes to check, and the escalation path. Pick the signal rule set now and write it in the plan. Start most characteristics on WECO rules 1 to 4, checked in that order, and reserve the full Nelson set for critical characteristics.
7. **Monitor in Phase II against the fixed limits.** Plot new subgroups in time order and check them against the baseline with `bin/spc.py monitor` for variables charts, passing the baseline center line and the baseline sigma of the plotted statistic, so the limits cannot drift with the new data. Check rules in the fixed order given in `references/formulas-and-constants.md` and report the first rule that fires for each signal. Do not recalculate limits because new data arrived. Limits are recalculated only after a documented, verified process change, followed by a fresh Phase I study.
8. **React at the first signal.** Follow the reaction plan in order: contain product back to the last in control subgroup, check the measurement system, then look for what changed at the time boundary the chart points to. Log the signal, the rule, the value, the cause found, and the action taken. If no cause is found, say so in the log and keep monitoring at a tighter sampling frequency for a defined window instead of adjusting the process to make the chart look calm.
9. **Read capability only on a stable process.** With the process in control, run `bin/spc.py capability` using the within subgroup sigma for Cp and Cpk, and overall sigma for Pp and Ppk when a study period view is needed. Report Cp and Cpk together: a high Cp with a low Cpk is a centering problem, both low is a spread problem. State the sigma used, the specification source, and whose threshold the result is compared against. Common convention is 1.33 as a minimum, with 1.67 for critical characteristics in some industries. Those are customer conventions, not laws of the method.
10. **Review on a cadence.** Revisit sampling frequency, subgrouping, and the rule set when volume, equipment, material, or the characteristic itself changes. Retire charts nobody reacts to. A chart with no reaction behind it is decoration, and decoration teaches the floor to ignore real signals.

## Output Contract

- **Chart decision:** the chart type, the data type and subgroup facts that forced it, and the runner-up that was rejected and why.
- **Baseline record:** number of subgroups and subgroup size, center line, control limits, sigma within estimate, the dispersion chart verdict, every point removed with the assignable cause that justified removing it, or a plain statement that none were removed.
- **Monitoring report:** each new point or subgroup checked against the frozen limits, signals listed with the rule name, the subgroup it fired at, and the value, in rule checking order. No signal is also a result and gets reported as such.
- **Capability statement:** Cp and Cpk (and Pp and Ppk when asked), the mean and sigma used and which kind of sigma it is, the specification limits and their source, and a plain reading of centering versus spread. Never a capability number for an unstable process without saying the process is unstable and the number does not hold.
- **Reaction record:** the filled reaction plan per signal, with containment window, measurement check result, cause found or an honest not found, and the action taken.

## Operating Rules

- Control limits come from process data and specification limits come from the customer or the design. Never substitute one for the other, in either direction.
- Stability before capability, always. Cp and Cpk calculated on an out of control process are arithmetic, not information.
- Adjusting a stable process because one in-limit point looked high or low is tampering. It increases variation. Leave an in control process alone.
- Read the dispersion chart before the location chart. Unstable variation invalidates the location limits.
- Remove a baseline point only with a found assignable cause, recorded. Removing points to make the baseline look stable is falsifying the baseline.
- Never recalculate limits to absorb a signal. A signal is information about the process, not an error in the chart.
- Count defectives on p or np and defects on c or u. One unit counted as defective three times belongs on a defects chart.
- Negative lower limits on attribute charts are set to zero. Counts and proportions cannot be negative.
- More signal rules means more false alarms. Rule 1 alone false alarms about once per 371 points on a stable process, and the four WECO rules together about once per 92. Pick the set in advance, by criticality, and do not add a rule after seeing a pattern you want it to catch.
- Too little variation is a signal too (Nelson 7). Fifteen points hugging the center line usually means stratified data, wrong limits, or readings that are not real measurements.
- Keep every claim about a specific process tied to its data file and calculator output. If a number did not come out of `bin/spc.py` or a hand check against `references/formulas-and-constants.md`, do not present it as calculated.
