Sub topic 8
Cpk: the distance to the nearest limit
This chapter assumes you can compute a mean and standard deviation. It also assumes you know Cp, the ratio of tolerance width to the 6-sigma process spread, and that you have estimated sigma from subgroups. Cp compares widths only, so it ignores where the process sits between the limits. Cpk fixes that by measuring the room the process has on its worse side.
The idea behind Cpk
A process can have a narrow spread and still produce defects if its mean has drifted toward one specification limit. Cp can't see this, because it uses only the width of the tolerance, USL − LSL. Cpk looks at the mean's distance to each limit separately and reports the smaller of the two results.
Each distance is measured in units of 3 sigma. That is half of the 6-sigma natural spread, so the distance is how many "half-spreads" fit between the mean and the limit. If the mean is exactly 3 sigma from a limit, the index for that side is 1.0.
The formulas are:
- Cpu = (USL − mean) / (3 × sigma)
- Cpl = (mean − LSL) / (3 × sigma)
- Cpk = min(Cpu, Cpl)
Cpu is the capability against the upper limit alone. Cpl is the capability against the lower limit alone. Cpk is whichever is worse, because the nearest limit is where most defects occur.
A worked example
Take a shaft diameter with LSL = 9.85, USL = 10.15, a process mean of 10.02 and a within-subgroup sigma of 0.05.
- Cp = (10.15 − 9.85) / (6 × 0.05) = 0.30 / 0.30 = 1.00.
- Cpu = (10.15 − 10.02) / (3 × 0.05) = 0.13 / 0.15 = 0.87.
- Cpl = (10.02 − 9.85) / (3 × 0.05) = 0.17 / 0.15 = 1.13.
- Cpk = min(0.87, 1.13) = 0.87.
Cp says the spread exactly fits the tolerance. Cpk says the process is worse than that, because the mean sits 0.02 above the midpoint of 10.00 and crowds the upper limit.
def cp_cpk(mean, sigma, lsl, usl):
cp = (usl - lsl) / (6 * sigma)
cpu = (usl - mean) / (3 * sigma)
cpl = (mean - lsl) / (3 * sigma)
return cp, cpu, cpl, min(cpu, cpl)
cp, cpu, cpl, cpk = cp_cpk(mean=10.02, sigma=0.05, lsl=9.85, usl=10.15)
print(round(cp, 2), round(cpu, 2), round(cpl, 2), round(cpk, 2))This prints 1.0 0.87 1.13 0.87. The function returns all four values on purpose. When a Cpk is low, you need Cpu and Cpl to see which side is the problem.
What happens as the mean drifts
Hold sigma at 0.05 and move the mean. Cp stays at 1.00 the whole time, because neither the spread nor the tolerance changes. Cpk falls steadily.
LSL, USL, SIGMA = 9.85, 10.15, 0.05
for mean in (10.00, 10.02, 10.05, 10.10, 10.15):
cpu = (USL - mean) / (3 * SIGMA)
cpl = (mean - LSL) / (3 * SIGMA)
print(f"mean={mean:.2f} Cpu={cpu:.2f} Cpl={cpl:.2f} Cpk={min(cpu, cpl):.2f}")The output is:
mean=10.00 Cpu=1.00 Cpl=1.00 Cpk=1.00
mean=10.02 Cpu=0.87 Cpl=1.13 Cpk=0.87
mean=10.05 Cpu=0.67 Cpl=1.33 Cpk=0.67
mean=10.10 Cpu=0.33 Cpl=1.67 Cpk=0.33
mean=10.15 Cpu=0.00 Cpl=2.00 Cpk=0.00Three things stand out in this table:
- When the mean is at the midpoint, Cpu equals Cpl and Cpk equals Cp. This is the best Cpk a process can reach for its spread. Cpk can never exceed Cp.
- Every 0.01 of drift toward the upper limit costs Cpu about 0.067 (0.01 / 0.15), and gains Cpl the same amount. Cpk follows the shrinking side only.
- At mean = USL, Cpk is 0. Half the output is beyond the limit, even though Cp still reads 1.00.
The relationship between Cp and Cpk
Define the midpoint m = (USL + LSL) / 2 and the half-tolerance T/2 = (USL − LSL) / 2. Then the mean's offset as a fraction of the half-tolerance is:
k = |mean − m| / (T/2)
With that, Cpk = Cp × (1 − k).
For the example, m = 10.00, T/2 = 0.15, and k = 0.02 / 0.15 = 0.133. So Cpk = 1.00 × (1 − 0.133) = 0.87, which matches the direct calculation.
This identity gives you a quick diagnosis. If Cp is high and Cpk is much lower, k is large, so the fix is to re-center the process, often by adjusting a machine setting or offset. If Cp and Cpk are both low and close together, the process is centered but too variable, and re-centering will not help. You have to reduce variation.
Negative Cpk and means outside the limits
Cpk is negative when the mean lies outside the specification limits. Suppose the mean is 10.20 with the same limits. Then Cpu = (10.15 − 10.20) / 0.15 = −0.33. A negative value is not an error. It means most of the output is out of specification. The same formula still works, and the sign tells you the mean is on the wrong side of a limit.
What Cpk depends on
Cpk is only as good as its inputs, and each one can mislead.
- The mean. You need an estimate of the long-run process mean. If the process is not stable, the mean moves and any single Cpk describes a moment, not the process.
- Sigma. Cpk uses the within-subgroup sigma, estimated for example as R-bar / d2. If you use the overall standard deviation of all data instead, you are computing Ppk, not Cpk. The two can differ a lot when the mean wanders.
- The limits. They must be the true engineering specifications. Control limits from a chart are not specification limits, and mixing them up gives meaningless indices.
- The distribution. The link between Cpk and defect rate assumes a roughly normal distribution. The index itself can be calculated for any data, but its usual interpretation cannot.
Connecting Cpk to defects
Cpk converts to a defect rate through the normal model. The distance from the mean to the nearest limit is 3 × Cpk standard deviations, so the z-score of that limit is z = 3 × Cpk. For the example, z on the upper side is 3 × 0.87 = 2.6, and z on the lower side is 3 × 1.13 = 3.4.
The tail probability beyond z = 2.6 is about 0.00466. Beyond z = 3.4 it is about 0.00034. The total is about 0.005, or roughly 5,000 parts per million (ppm) out of specification. Nearly all of those come from the upper tail, which is why the nearest limit dominates.
from statistics import NormalDist
def expected_ppm(mean, sigma, lsl, usl):
dist = NormalDist(mu=mean, sigma=sigma)
below = dist.cdf(lsl)
above = 1 - dist.cdf(usl)
return (below + above) * 1_000_000
print(round(expected_ppm(10.02, 0.05, 9.85, 10.15)))The result is about 4,998 ppm. A centered process with Cp = 1.00 would produce about 2,700 ppm, so the drift nearly doubles the defects.
Notice that Cpk alone gives only a one-sided picture. The Cpk value of 0.87 would suggest about 4,660 ppm if you counted only the nearest tail. The small far-tail contribution (about 340 ppm here) is why the full calculation is slightly higher. When Cpk is high, the far tail is negligible, so Cpk alone is a good approximation.
Common errors
- Reporting Cpk without Cp or the mean. A Cpk of 0.87 could be a centered, wide process or an off-center, tight one. Report both indices, or Cpu and Cpl, so the reader can tell which.
- Using the wrong sigma. Plugging in the overall standard deviation and calling the result Cpk mixes up Cpk and Ppk. State which sigma you used.
- Using the target instead of the mean. Cpk uses the actual process mean, not the nominal value. Using the nominal value gives Cp and hides any offset.
- Averaging Cpk across batches or machines. Cpk is not additive and the mean shifts between sources. Compute it for each stable process stream.
- Treating a single value as exact. Cpk is an estimate from a sample. With small samples it has wide uncertainty, which a later chapter covers.
Summary
Cpk is the smaller of Cpu and Cpl, each being the distance from the mean to a limit divided by 3 sigma. It never exceeds Cp, and it equals Cp only when the process is centered. The gap between Cp and Cpk measures how far off-center the process is, and the sign of Cpk tells you whether the mean is inside the limits.
Exercise
A process has LSL = 50, USL = 60, mean = 58 and within-subgroup sigma = 1.2. Calculate Cp, Cpu, Cpl and Cpk. Which limit is the problem, and what is the approximate gap between Cp and Cpk caused by centering?
Show answer
Cp = (60 − 50) / (6 × 1.2) = 10 / 7.2 = 1.39. Cpu = (60 − 58) / (3 × 1.2) = 2 / 3.6 = 0.56. Cpl = (58 − 50) / 3.6 = 8 / 3.6 = 2.22. Cpk = min(0.56, 2.22) = 0.56. The upper limit is the problem. The process spread fits comfortably (Cp = 1.39), but the mean is off-center by 3 units from the midpoint of 55, so Cpk is lower than Cp by about 0.83. As a check, k = 3 / 5 = 0.6 and Cp × (1 − k) = 1.39 × 0.4 = 0.56.
Exercise
A process has Cp = 1.50 and Cpk = 1.50. A second process has Cp = 1.50 and Cpk = 0.90. What does each pair tell you, and what action would you take for the second process?
Show answer
The first process is centered, because Cpk equals Cp. Its spread is well within the tolerance and it needs no centering action. The second process has the same spread, but Cpk is far below Cp, so the mean is close to one limit. The fix is to shift the mean toward the midpoint, for example by adjusting a machine setting. Reducing variation would be less efficient here, since the spread is already narrow enough. After re-centering, Cpk should rise toward 1.50.
Exercise
A process has LSL = 9.85, USL = 10.15, sigma = 0.05 and mean = 10.20. What is Cpk, and what does its sign mean?
Show answer
Cpu = (10.15 − 10.20) / 0.15 = −0.33 and Cpl = (10.20 − 9.85) / 0.15 = 2.33. Cpk = min(−0.33, 2.33) = −0.33. The negative sign means the mean lies outside the upper specification limit, so more than half of the output is out of specification.