Sub topic 12
Checking normality and what to do when it fails
This chapter assumes you can compute Cp and Cpk from a mean, a standard deviation and specification limits. It also assumes you know the sigma-within estimate and have checked that the process is stable. You should know the normal curve and what a histogram shows. You do not need to know the Python statistics libraries, although the code uses them.
Why normality matters for capability
The formulas for Cp and Cpk only need a mean and a standard deviation. They will return a number for any data. The normality assumption enters when you give that number a meaning:
- A Cpk of 1.33 means the nearest limit sits 4 standard deviations from the mean. That corresponds to a specific tail probability only if the data follow a normal curve.
- The conversion from Cpk to expected defects per million (ppm) uses the normal tail area.
- The "6-sigma natural spread" (the mean plus or minus 3 sigma) covers about 99.73% of the output only under a normal model.
For a skewed process, the index can look excellent while the long tail of the distribution crosses a limit. The index also fails the other way. A bounded process, such as flatness or runout that cannot go below zero, can look poor when the real defect rate is small.
Normality is the second thing to check, after stability. If the process is unstable, every statistic you compute describes a moving target. Fix stability before you worry about distribution shape.
Checking normality: look first, then test
Use a graph first and a test second. A test only tells you whether a departure is detectable. The graph shows what kind of departure it is and whether it matters.
Graphical checks
- Histogram. Look for skew, a flat top, two humps, or a hard edge on one side.
- Normal probability plot. Normal data fall close to a straight line. A curved line indicates skew. An S-shape indicates heavy or light tails. A step pattern indicates coarse measurement resolution. A few points far off the line at one end indicate outliers.
Check the tails of the probability plot most carefully. Capability depends on the tails, and the middle of the data can look normal while the tails do not.
Formal tests
| Test | What it does | Notes |
|---|---|---|
| Anderson-Darling | Compares the empirical and normal cumulative distributions, with extra weight on the tails | A common choice in capability software. Compare the statistic to critical values or use a p-value. |
| Shapiro-Wilk | Measures how well ordered data match normal quantiles | Good power for small and medium samples. |
| Kolmogorov-Smirnov | Largest gap between empirical and normal curves | Low power. When mean and sigma are estimated from the same data, the standard version is too lenient. |
For all of these, the null hypothesis is that the data are normal. A small p-value (commonly below 0.05) is evidence against normality. A large p-value does not prove normality. It means the test found no clear evidence.
Sample size changes how the test behaves:
- With a few dozen points, a test has little power, so it can pass a clearly skewed process.
- With thousands of points, it rejects trivial departures that have no practical effect on Cpk.
When a test result and the plot disagree, trust the plot and ask whether the departure is large enough to change the defect estimate.
A runnable check
The code below needs numpy and scipy. It simulates a skewed process with only an upper limit, runs two tests, and then compares the normal-model estimate with one that respects the skew.
import numpy as np
from scipy import stats
rng = np.random.default_rng(42)
data = rng.lognormal(mean=0.0, sigma=0.4, size=500) # skewed, cannot go below zero
usl = 4.0
# 1. Formal normality tests
w, p_sw = stats.shapiro(data)
ad = stats.anderson(data, dist="norm")
print(f"Shapiro-Wilk p-value: {p_sw:.2e}")
print(f"Anderson-Darling statistic: {ad.statistic:.2f}")
print(f" 5% critical value: {ad.critical_values[2]:.3f}")
print(f"Skewness: {stats.skew(data):.2f}")
# 2. Normal-model estimate of the upper capability and defect rate
m, s = data.mean(), data.std(ddof=1)
cpu_normal = (usl - m) / (3 * s)
ppm_normal = stats.norm.sf(usl, loc=m, scale=s) * 1_000_000
# 3. Fit a lognormal distribution (location fixed at zero) and use percentiles
shape, loc, scale = stats.lognorm.fit(data, floc=0)
median = stats.lognorm.ppf(0.5, shape, loc, scale)
p99865 = stats.lognorm.ppf(0.99865, shape, loc, scale)
cpu_fitted = (usl - median) / (p99865 - median)
ppm_fitted = stats.lognorm.sf(usl, shape, loc, scale) * 1_000_000
print(f"Normal model: Cpu = {cpu_normal:.2f}, expected ppm above USL = {ppm_normal:.3f}")
print(f"Lognormal fit: Cpu = {cpu_fitted:.2f}, expected ppm above USL = {ppm_fitted:.0f}")Both tests should reject normality decisively for this data, and the skewness should be clearly positive. The two capability estimates should also disagree sharply. The normal model gives a Cpu above 2 and a defect rate far below 1 ppm. The fitted lognormal gives a Cpu near 1.3 and a defect rate in the low hundreds of ppm. The exact figures vary with the random sample, but the gap does not. The normal model hides a tail that sends several hundred parts per million past the limit.
Common reasons data look non-normal
A failed normality check is a symptom. Identify the cause before you choose a fix, because some causes call for a process fix and not a statistical one.
- Instability. Shifts and drifts blend several distributions into one wide, odd-shaped one. Go back to the control chart.
- Mixed sources. Two machines, cavities, shifts or material lots with different means produce a two-humped or flat-topped histogram. Stratify the data and assess each source, or fix the difference.
- Natural boundaries. Quantities such as roundness, concentration, defect size, or time-to-failure cannot be negative and are often skewed to the right.
- Truncated data. If parts outside the limits were sorted out before measurement, the histogram has an artificial cut-off. The capability computed from it is too optimistic.
- Coarse resolution. If the gauge steps are large compared with the process sigma, the data fall on a few discrete values. Improve the measurement system.
- Outliers. A few points from typing errors, handling damage or special events distort both the mean and the sigma. Investigate each one. Do not delete a point only because it hurts the index.
What to do when normality fails
The next diagram shows the usual order of decisions.
Option 1: transform the data
A transformation such as the Box-Cox power transform or the log makes skewed data closer to normal. You then transform the specification limits with the same function and compute Cpk on the transformed scale. The advantage is that the usual formulas still apply. The cost is that the numbers are in transformed units, which are hard to explain to a production team. A transformation also needs a reasonable amount of data to choose its parameter reliably.
Option 2: fit a non-normal distribution
If you have a physical reason to expect a distribution, such as lognormal for a positive and right-skewed measure or Weibull for lifetimes, fit it and read the capability from its percentiles. The code above does this. The generalized form of the index uses the median as the center and the 0.135% and 99.865% points of the fitted distribution as the ends of the natural spread:
- Cpu = (USL - median) / (P99.865 - median)
- Cpl = (median - LSL) / (median - P0.135)
- Cpk = min(Cpu, Cpl)
For a normal distribution these equal the standard formulas. For a skewed one, they use the real tail on each side.
Option 3: use empirical percentiles
If no standard distribution fits, take the percentiles directly from the data. This is the most assumption-free route. It also needs the most data. The 99.865th percentile of a sample of 200 points rests on one or two observations, so it is mostly noise. You generally need many hundreds or thousands of points for stable percentile estimates in the tails.
Option 4: report the observed defect rate
If the sample is large and the process is stable, the fraction of measured parts outside the limits is a direct estimate of the defect rate, and no model is needed. It cannot see rare events beyond what you sampled. Pair it with one of the model-based estimates.
Edge cases
- Large samples reject mild non-normality. With many thousands of points, a p-value near zero can occur for a histogram that looks normal and gives nearly the same Cpk. Judge by the tails on the probability plot and by how much the estimated ppm changes.
- Small samples hide non-normality. With fewer than about 30 points, a passing test is weak evidence. Combine it with process knowledge.
- Subgroup data. Tests apply to individual values. Check normality on the individual measurements, ideally after removing subgroup-to-subgroup shifts. Subgroup means tend toward normal even when individuals are not (the central limit theorem), so a normal-looking chart of means says nothing about the individuals.
- Two-sided and one-sided limits. For a one-sided specification, only one tail matters. A skew that pushes the tail toward the limit is damaging, and a skew that pushes it away is harmless.
Exercise
A process has a two-sided specification. A histogram of 400 measurements shows two clear humps, and an Anderson-Darling test rejects normality. A colleague proposes a Box-Cox transformation so that the Cpk can be reported. What should you do first, and why?
Show answer
First find out why there are two humps. Two humps usually mean two sources are mixed, such as two machines, cavities or material lots, or the process shifted between two levels. A transformation would hide that structure and give a Cpk that describes no real process. Stratify the data by source and check stability for each one. If the humps come from a fixable difference, fix it and collect new data. If the sources are expected, assess each source separately or report them with clear labels. Consider a transformation or a fitted distribution only after the data are stable and come from a single source.
Exercise
Why is the 99.865th percentile of a sample of 200 measurements a poor basis for an empirical-percentile capability estimate, and what are two ways to improve it?
Show answer
0.135% of 200 points is about 0.27 of an observation, so the 99.865th percentile is set by the single largest value or an interpolation next to it. A different sample would give a very different number. Two improvements are to collect many more points, so that the tail holds several observations, or to fit a distribution that has a physical justification, such as lognormal or Weibull, and read the percentile from the fitted curve. The fitted-curve approach uses all the data to shape the tail, but its result is only as good as the assumed distribution.