Sub topic 14
Sample Size and Confidence in a Cpk Estimate
Assume you know how to calculate a mean and standard deviation and understand the basic normal distribution. Reading a control chart is helpful because capability indices should be calculated only after checking process stability.
A reported Cpk is an estimate, not an exact property of the process. It depends on the observations collected, the estimated mean, and the estimated standard deviation. A different sample can produce a different Cpk even when the process has not changed.
Why sample size matters
Cpk is calculated from the nearer specification limit:
Cpk = min(Cpu, Cpl)
Cpu = (USL − mean) / (3 × sigma)
Cpl = (mean − LSL) / (3 × sigma)
The mean becomes more precise as the sample grows. The standard deviation also becomes more precise, but its estimate can be unstable in a small sample. Because Cpk uses the smaller of Cpu and Cpl, an error in either side can affect the result.
When sigma is estimated from subgroups, the number of subgroups matters. Six subgroups of five observations usually provide a weaker estimate of within-subgroup variation than twenty subgroups of five observations, even though both examples contain many observations.
| Data collection | Main limitation | Practical implication |
|---|---|---|
| One small sample | Mean and sigma are uncertain | Treat Cpk as an initial estimate |
| Several subgroups | More information about repeatable variation | A more useful short-term estimate |
| Large, stable data set | Lower sampling error | Still check model and measurement assumptions |
There is no universal sample size that guarantees a narrow confidence interval. The required size depends on the true Cpk, the amount of variation, subgroup size, and the precision needed for the decision.
Confidence intervals for Cpk
A confidence interval gives a range of plausible values for the underlying process capability. For example, a 95% interval is designed so that, over many repeated samples, about 95% of intervals produced by the method contain the true value.
It does not mean that there is a 95% probability that the fixed process value lies inside this one calculated interval.
Analytical confidence intervals use probability distributions for the estimated mean and standard deviation. They can be accurate, but the formulas depend on assumptions and on whether Cpk is based on within-subgroup or overall variation. A bootstrap is a practical alternative. It repeatedly resamples the observed data, recalculates Cpk, and uses the resulting distribution to form percentile limits.
from math import sqrt
from random import Random
from statistics import mean
def cpk(values, lsl, usl):
x_bar = mean(values)
s = sqrt(sum((x - x_bar) ** 2 for x in values) / (len(values) - 1))
cpu = (usl - x_bar) / (3 * s)
cpl = (x_bar - lsl) / (3 * s)
return min(cpu, cpl)
data = [10.01, 10.03, 9.99, 10.02, 10.00,
10.04, 10.00, 10.02, 10.01, 10.03,
9.98, 10.01, 10.00, 10.02, 9.99]
lsl, usl = 9.85, 10.15
rng = Random(7)
estimates = []
for _ in range(2000):
sample = [data[rng.randrange(len(data))] for _ in data]
estimates.append(cpk(sample, lsl, usl))
estimates.sort()
lower = estimates[int(0.025 * len(estimates))]
upper = estimates[int(0.975 * len(estimates))]
print("Cpk:", round(cpk(data, lsl, usl), 2))
print("Approximate 95% interval:", round(lower, 2), "to", round(upper, 2))When Cpk is close to a decision threshold such as 1.33, report the interval rather than only the point estimate. If the interval spans the threshold, the data do not support a confident pass-or-fail conclusion.
Exercise
Why is twenty subgroups of five observations generally more informative for estimating within-subgroup sigma than one subgroup of 100 observations?
Show answer
Multiple subgroups show how short-term variation repeats across time. One large subgroup gives little information about changes between subgroups and may not estimate the intended within-subgroup variation reliably.