Skip to content
AITroveRead. Build. Understand.
Make this comfortable

Process capability: check stability before interpreting Cpk

Last updated: 7 Oct 20265 min read
tutorial
AdvancedBy AITrove Editorial

A process capability index compares the center and spread of a stable process with fixed engineering limits.

Separate specifications from data

A filling line must place each pouch between 247 and 253 grams. Those limits come from the product contract, not from the observed sample. For an approximately normal and stable process, Cpk uses the smaller distance from the process mean to either limit divided by three standard deviations. It differs from a two-sided spread-only index because off-center filling wastes room near one limit. The code calculates an illustrative sample Cpk but cannot itself establish that the process is stable or normal.

Inspect the time order first

A combined pouch sample can have an acceptable mean and spread while night shifts drift upward and morning shifts drift down. Plot measurements in production order, separate shifts and batches, and investigate any changes in calibration, ingredient density or scale. A capability index on a changing mixture does not describe one persistent process. CUSUM monitoring can flag a shift prospectively; the shift lesson distinguishes a planned equipment change from a searched break.

Check tails and measurement error

A normal assumption can be poor for clipped, skewed or mixed fill weights. Compare actual below- and above-limit counts and the distribution shape with the model’s implication. A small sample standard deviation can also be misleading if a scale rounds values heavily or loses accuracy near the limit. Repeatability isolates instrument noise; a tolerance bound asks a separate population-coverage question.

Make the number subordinate to the decision

Report limits, target, units, sample period, line and shift count, stability evidence, distribution checks, estimated Cpk and uncertainty. A point value above a company threshold is not a guarantee that future production meets specification, especially when the estimate is based on few independent batches. The project requires a release packet that keeps engineering limits separate from statistical control limits.

Implementation

python
from statistics import mean, stdev

def fill_weight_cpk(weights_g, lower_g, upper_g):
    if len(weights_g) < 2 or not lower_g < upper_g:
        raise ValueError("measurements and ordered limits required")
    process_sd = stdev(weights_g)
    if process_sd <= 0:
        raise ValueError("positive measured spread required")
    process_mean = mean(weights_g)
    return min(upper_g - process_mean, process_mean - lower_g) / (3 * process_sd)

capability = fill_weight_cpk([249.8, 250.0, 250.2], 247, 253)
assert round(capability, 3) == 5.0

Performance and operating cost

Computing mean, standard deviation and Cpk is O(n) time and O(1) extra space over n weights. Keeping time order and batch metadata adds O(n) storage but is necessary for stability checks. A fast index from unstable data is not a shortcut to process qualification.

Common Mistakes

  • Computing capability before checking that the process is stable.
  • Calling statistical control limits engineering specifications.
  • Assuming a normal tail when observed weights are skewed or mixed.
  • Reading one estimated Cpk as a guaranteed future defect fraction.

Read next

ai-data
applied-statistics
Storage details