developer guide
SPC Control Charts, Cp and Cpk in a Data Grid
Give a column a specification and the grid works out where the process sits against it: control limits taken from a baseline period, capability and performance indices, and a confidence interval around each figure so a small sample is not read as a precise one.
Developer guide › Statistics and capability › SPC Control Charts, Cp and Cpk in a Data Grid
Process control and capability
Whether a process sits inside the tolerance it was given, and whether it is behaving or drifting. The tolerance is declared once, on the column.
The specification lives with the column
{ id: 'diameter', type: 'number', spec: { lower: 9.95, upper: 10.05, target: 10 } }
Asking for the capability
const c = grid.statistics.capability('diameter', { rules: 'nelson' });
c.cp; c.cpk; // short-term spread, from the moving range
c.pp; c.ppk; // overall spread
c.outOfSpec; // parts outside the customer's tolerance
c.limits; // { centre, upper, lower, sigma }
c.violations; // [{ index, rule, description }, …]
c.interval; // a confidence interval for cpk
One declared tolerance, so nothing can disagree. The indices, the charts
and any conditional format all read the same spec. A tolerance passed separately
to each is a tolerance that eventually differs between them, and a capability report that
contradicts the cell colouring is worse than neither.
Cp and Cpk use short-term variation, Pp and Ppk overall. The first pair comes from the moving range, which is what the process can do when it is behaving; the second from the whole spread, which is what it actually delivered. Ppk well below Cpk is the signal that the process drifted rather than that it is incapable.
A baseline finds a shift instead of absorbing it. baseline: 30
fixes the limits over the first thirty readings. Limits recomputed over all the data widen to
accommodate the very shift you are looking for, and then report no violation.
The point estimate alone overstates the case. A Cpk of 1.35 measured on
thirty parts has a lower bound below 1.0, so a process that has "passed" a 1.33 requirement on
thirty parts has demonstrated very little. interval is reported alongside it for
that reason.
Drawing it
Three chart types complete the picture, and they read the same specification.
| Type | Shows |
|---|---|
| control | Readings against the centre line and control limits, with every rule break numbered. |
| movingRange | The companion chart: variation between consecutive readings. |
| capability | The distribution against the tolerance, with a curve for each of the two spreads. |
Rule breaks are numbered rather than merely marked, under Western Electric's four rules or Nelson's eight. The two sets number differently, so the chart names which it applied: a "rule 3" that could mean either is not a finding anyone can act on.
Confidence intervals
How firmly the data pins a figure down. An interval narrows as the grid does, because it describes the filtered rows and not the whole table.
A mean and a rate
grid.statistics.interval('capacity');
// { lower, upper, mean, n, confidence }, by Student's t
grid.statistics.interval('status', {
kind: 'proportion',
where: (v) => v === 'failed',
});
// Wilson score, which stays sensible at small n and near 0 or 1
Intervals are also available on a regression slope and on a capability index. Each uses the method that suits it: Student's t for a mean, the Wilson score for a proportion, and Bissell's approximation for Cpk.
The line the product draws. Lattice quantifies uncertainty. It does not adjudicate hypotheses: there are no p-values and no significance tests. An interval says how precisely a figure is known and leaves the judgement where it belongs. A tool that returns a verdict invites it to be read as one, and a grid is the wrong place for that.
Wilson, not the textbook formula. The normal approximation gives bounds below zero and above one at small counts, which is visibly wrong to anyone who reads it. The Wilson score stays inside the interval it is describing.