Skip to content
FlowScript templates

Quality — process capability (Cp / Cpk)

Process capability study whose indices are computed from the subgroups that were actually measured, not copied off the SPC terminal. Typed FlowScript for reliability engineering. Keywords: FMEA, failure mode, RPN, reliability.

Template previewFlowScript
Bore diameter — six subgroups of five, one shiftFigure: Bore diameter — six subgroups of five, one shift. Violin plot. Horizontal axis: Value (mm), linear scale, from 11.925 to 12.075. 6 series. 08:15 (12.004 mm, interval 11.986 to 12.017, n = 5); 09:45 (11.998 mm, interval 11.985 to 12.014, n = 5); 11:10 (12.008 mm, interval 12 to 12.019, n = 5); 13:30 (11.995 mm, interval 11.995 to 12.012, n = 5); 15:00 (11.999 mm, interval 11.988 to 12.007, n = 5); 16:20 (11.997 mm, interval 11.994 to 12.021, n = 5). Observations: n = 30 observations. Uncertainty: the interquartile range. Not stated in the figure data: axes, effect. 08:15: n = 5, median 12.004 (IQR 11.986 to 12.017), mean 12.004 (SD 0.021), range 11.982 to 12.031, density bandwidth 0.0135 by the silverman rule. 09:45: n = 5, median 11.998 (IQR 11.985 to 12.014), mean 11.998 (SD 0.021), range 11.971 to 12.022, density bandwidth 0.0136 by the silverman rule. 11:10: n = 5, median 12.008 (IQR 12.000 to 12.019), mean 12.011 (SD 0.017), range 11.992 to 12.036, density bandwidth 0.0092 by the silverman rule. 13:30: n = 5, median 11.995 (IQR 11.995 to 12.012), mean 12.001 (SD 0.017), range 11.979 to 12.024, density bandwidth 0.0082 by the silverman rule. 15:00: n = 5, median 11.999 (IQR 11.988 to 12.007), mean 11.995 (SD 0.018), range 11.968 to 12.013, density bandwidth 0.0092 by the silverman rule. 16:20: n = 5, median 11.997 (IQR 11.994 to 12.021), mean 12.007 (SD 0.019), range 11.990 to 12.033, density bandwidth 0.0123 by the silverman rule. 08:15: Bandwidth h = 0.01347 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 08:15: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree. 09:45: Bandwidth h = 0.01357 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 09:45: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree. 11:10: Bandwidth h = 0.009187 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 11:10: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree. 13:30: Bandwidth h = 0.008220 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 13:30: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree. 15:00: Bandwidth h = 0.009187 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 15:00: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree. 16:20: Bandwidth h = 0.01233 by the silverman rule. Both rules of thumb are derived for normal data and OVER-SMOOTH a multimodal density: if the violin's shape is the claim, show it at two bandwidths or say which one you chose. 16:20: Quartiles by Hyndman–Fan type 7; the fences use the same definition, so the box and the outlier rule cannot disagree.Bore diameter — six subgroups of five, one shift08:15: kernel density, h = 0.0135 (silverman rule)08:15: median 12.004, hinges 11.986 and 12.017, whiskers to 11.982 and 12.031 (1.5×IQR), mean 12.004mean 12.00408:15: all 5 observation(s), jittered vertically by a seeded hash of each value12.004 mm12.031 mm11.986 mm12.017 mm11.982 mm08:15n = 5, median 12.004 [11.986–12.017]09:45: kernel density, h = 0.0136 (silverman rule)09:45: median 11.998, hinges 11.985 and 12.014, whiskers to 11.971 and 12.022 (1.5×IQR), mean 11.998mean 11.99809:45: all 5 observation(s), jittered vertically by a seeded hash of each value11.998 mm11.971 mm12.014 mm11.985 mm12.022 mm09:45n = 5, median 11.998 [11.985–12.014]11:10: kernel density, h = 0.0092 (silverman rule)11:10: median 12.008, hinges 12.000 and 12.019, whiskers to 11.992 and 12.036 (1.5×IQR), mean 12.011mean 12.01111:10: all 5 observation(s), jittered vertically by a seeded hash of each value12.019 mm12.036 mm11.992 mm12.008 mm12.000 mm11:10n = 5, median 12.008 [12.000–12.019]13:30: kernel density, h = 0.0082 (silverman rule)13:30: median 11.995, hinges 11.995 and 12.012, whiskers to 11.979 and 12.024 (1.5×IQR), mean 12.001mean 12.00113:30: all 5 observation(s), jittered vertically by a seeded hash of each value12.012 mm11.979 mm12.024 mm11.995 mm11.995 mm13:30n = 5, median 11.995 [11.995–12.012]15:00: kernel density, h = 0.0092 (silverman rule)15:00: median 11.999, hinges 11.988 and 12.007, whiskers to 11.968 and 12.013 (1.5×IQR), mean 11.995mean 11.99515:00: all 5 observation(s), jittered vertically by a seeded hash of each value11.988 mm12.013 mm11.968 mm11.999 mm12.007 mm15:00n = 5, median 11.999 [11.988–12.007]16:20: kernel density, h = 0.0123 (silverman rule)16:20: median 11.997, hinges 11.994 and 12.021, whiskers to 11.990 and 12.033 (1.5×IQR), mean 12.007mean 12.00716:20: all 5 observation(s), jittered vertically by a seeded hash of each value12.021 mm11.994 mm12.033 mm11.990 mm11.997 mm16:20n = 5, median 11.997 [11.994–12.021]11.92511.95011.97512.00012.02512.05012.075Value (mm)Raincloud (Allen et al. 2019): half violin = Gaussian kernel density; box = median, hinges and Tukey 1.5×IQR whiskers with the mean as a diamond; points= every individual observation. The points are the data; the cloud and the box are summaries of them.Bandwidth by the silverman rule of thumb: 08:15 h = 0.0135; 09:45 h = 0.0136; 11:10 h = 0.0092; 13:30 h = 0.0082; 15:00 h = 0.0092; 16:20 h = 0.0123. Adensity's silhouette depends on its bandwidth as much as on its data, and both rules of thumb are derived for normal data — they OVER-smooth agenuinely multimodal density. If the shape is the claim, show it at two bandwidths.Vertical offsets in the rain are a deterministic hash of each observation's own value, its position in the list, and a seed taken from the block and group ids— never a random number. The same document therefore draws the same cloud on every machine and every run, and the offset carries no information.3 palette colour(s) darkened or lightened to clear 3:1 against the panel.

Make it your own.

// Process capability study whose indices are computed from the
// subgroups that were actually measured, not copied off the SPC terminal.
//
// The characteristic is a moulded bore on a clutch-pedal bush, nominal
// 12.000 mm with a bilateral tolerance of 0.100 mm, sampled five at a time
// across one shift. Sigma-within is s-bar / c4 rather than R-bar / d2:
// with n = 5 the sample standard deviation is the more efficient
// estimator, and each subgroup already carries its own s.
//
// Cp compares the tolerance with the spread; Cpk also charges the process
// for being off centre; Cpm charges it for missing the target. All three
// are derivations here, so correcting one measurement moves all of them.

capability_study bore_study {
  title: "Bore capability — PB-4471 clutch pedal bush"
  part: "PB-4471, PA66-GF30, tool 4-cavity, cavity 3 only"
  characteristic: "Bore diameter, measured 24 h after ejection at 20 °C"
  process: "Engel Victory 180 t press, line 2"
  standard: "ISO 22514-2:2017, procedure for a stable normal process"
  nominal: 12.000 mm
  target: 12.000 mm
  usl: 12.100 mm
  lsl: 11.900 mm
  tolerance: = usl - lsl
  subgroup_size: 5
  subgroups: 6
  sampling_interval: 90 min
  // c4 corrects the bias in s as an estimator of sigma; the value is the
  // published constant for n = 5, not something these data can produce.
  c4: 0.9400 source "ISO 22514-2 Table 3, n = 5"
}

// The thirty measurements live here once, as six subgroups of five. Each
// group carries the mean and s of its own five values because FlowScript
// aggregates ACROSS blocks, not within a list — so these two summaries are
// the only numbers in the document that are recorded rather than derived.
distribution bore_diameter {
  title: "Bore diameter — six subgroups of five, one shift"
  kind: raincloud
  unit: "mm"
  whisker: tukey
  jitter: true
  n: 30

  group sg_0815 {
    label: "08:15"
    values: [12.004, 12.031, 11.986, 12.017, 11.982]
    n: 5
    mean: 12.0040
    sd: 0.02065
  }

  group sg_0945 {
    label: "09:45"
    values: [11.998, 11.971, 12.014, 11.985, 12.022]
    n: 5
    mean: 11.9980
    sd: 0.02080
  }

  group sg_1110 {
    label: "11:10"
    values: [12.019, 12.036, 11.992, 12.008, 12.000]
    n: 5
    mean: 12.0110
    sd: 0.01718
  }

  group sg_1330 {
    label: "13:30"
    values: [12.012, 11.979, 12.024, 11.995, 11.995]
    n: 5
    mean: 12.0010
    sd: 0.01736
  }

  group sg_1500 {
    label: "15:00"
    values: [11.988, 12.013, 11.968, 11.999, 12.007]
    n: 5
    mean: 11.9950
    sd: 0.01776
  }

  group sg_1620 {
    label: "16:20"
    values: [12.021, 11.994, 12.033, 11.990, 11.997]
    n: 5
    mean: 12.0070
    sd: 0.01891
  }
}

capability_indices bore_indices {
  of: bore_study
  // An aggregate deliberately returns a bare number, so the millimetre is
  // attached once, here, and every index below is then dimensionless.
  grand_mean: = mean(kind:group, "mean") * 1[mm]
  s_bar: = mean(kind:group, "sd") * 1[mm]
  sigma_within: = s_bar / bore_study.c4
  cp: = bore_study.tolerance / (6 * sigma_within)
  cpu: = (bore_study.usl - grand_mean) / (3 * sigma_within)
  cpl: = (grand_mean - bore_study.lsl) / (3 * sigma_within)
  cpk: = min(cpu, cpl)
  cpm: = cp / sqrt(1 + ((grand_mean - bore_study.target) / sigma_within) ^ 2)
  z_min: = 3 * cpk
  // Performance indices use the overall spread of all thirty readings, so
  // between-subgroup drift is charged to the process rather than hidden.
  sigma_overall: 0.0203 mm source { dataset: "bore_2026_03.csv", column: "bore_mm", rows: 30, aggregation: "sd" }
  pp: = bore_study.tolerance / (6 * sigma_overall)
  ppk: = min((bore_study.usl - grand_mean) / (3 * sigma_overall), (grand_mean - bore_study.lsl) / (3 * sigma_overall))
  // Cp / Pp near 1 says the subgroups are not drifting apart: the process
  // is in control, and the capability number means what it claims.
  stability_ratio: = cp / pp
}

control_chart bore_xbar_s {
  metric: "Bore diameter, mm — subgroup of 5 every 90 minutes"
  chart: "X-bar and s"
  baseline_period: "2026-02-02 to 2026-02-27, 125 subgroups"
  baseline_n: 125
  centre_line: "X-bar-bar 12.0021 mm, s-bar 0.0187 mm, both frozen from the February baseline and not re-based since"
  limits: "3-sigma X-bar limits 11.9770 / 12.0272 mm from s-bar / c4; s-chart limits from B3, B4 at n = 5"
  intervention_at: "Screw-tip and non-return valve replaced 2026-03-09 during planned maintenance; no shift followed"
  rules: [
    "One point beyond 3 sigma",
    "Nine consecutive points on one side of the centre line",
    "Six consecutive points increasing or decreasing",
    "Two of three consecutive points beyond 2 sigma on the same side"
  ]
  special_cause: "None in this shift. The 11:10 subgroup is the highest of the six and remains inside 2 sigma."
  annotations: "Material lot change at 13:00 is marked on the chart; the 13:30 subgroup follows it."
}

cite iso22514 {
  key: "iso22514-2"
  title: "ISO 22514-2:2017 — Statistical methods in process management. Capability and performance: process capability and performance of time-dependent process models"
  publisher: "International Organization for Standardization"
  year: 2017
  type: "guideline"
  of: bore_study
}

note capability_caveat {
  text: "Cpk on six subgroups is an estimate with a wide interval — roughly 1.62 (1.24 to 2.00) at 95%. Customer capability requirements are normally judged on 25 subgroups; this shift is a check, not the submission."
  anchor: bore_indices
}

view spread: raincloud(bore_diameter)

caption bore_caption {
  of: spread
  title: "Bore diameter by subgroup"
  text: "Thirty bores measured across one shift, drawn as a raincloud so every reading, the shape of the distribution and the robust summary are all visible. Specification limits 11.900 and 12.100 mm."
  statistics: "Box shows median and hinges with Tukey whiskers; every observation is drawn."
  n_statement: "n = 30 bores in six subgroups of five, one cavity."
  style: journal
}

alt bore_alt {
  of: spread
  text: "Six subgroups of bore measurements, all comfortably inside the specification limits, centred slightly above nominal."
  summary: "Capability is adequate and the process is centred a little high."
}