control_chart
Statistical process control: X-bar and R, X-bar and S, and individuals / moving-range charts from subgrouped data, with d2, d3 and c4 computed by integration over the normal distribution (no copied table), Western Electric or Nelson run rules, capability Cp, Cpk, Pp, Ppk and the expected parts per million outside the specification.
- Field
- Measurement and data
- Version
- 0.1.0
- Runs as
- Compiled (Rust)
- Typical run
- 0.1 s
Compiled from source: run sh packs/install.sh once before admitting it.
Known answers it must pass
r0001n = 2 closed forms: d2 = 2/sqrt(pi), d3 = sqrt(2 - 4/pi), c4 = sqrt(2/pi), D4 = 1 + 3 sqrt(pi/2 - 1) (textbook 3.267); d2, d3 by 12-point Gauss-Legendre quadrature, rel 1e-8passed
constants.d2{"value": 1.1283791670955126, "rel_tol": 1e-08}constants.d3{"value": 0.8525024664274217, "rel_tol": 1e-08}constants.c4{"value": 0.7978845608028654, "rel_tol": 1e-09}constants.c4_gamma{"value": 0.7978845608028654, "rel_tol": 1e-12}constants.D4{"value": 3.2665319192886013, "rel_tol": 1e-08}r0002n = 3 closed forms: d2 = 3/sqrt(pi), c4 = Gamma(3/2) = sqrt(pi)/2, rel 1e-8 (quadrature)passed
constants.d2{"value": 1.692568750643269, "rel_tol": 1e-08}constants.c4{"value": 0.8862269254527579, "rel_tol": 1e-09}r0003n = 5: c4 = sqrt(2/4) Gamma(5/2)/Gamma(2) = 3 sqrt(pi)/(4 sqrt 2), A3 = 3/(c4 sqrt 5) (closed forms, rel 1e-9); d2(5) = 2.32593 and A2(5) = 0.577 (Tippett 1925 / ASTM STP 15D textbook table, abs to its last digit)passed
constants.c4{"value": 0.9399856029866251, "rel_tol": 1e-09}constants.A3{"value": 1.427299292922217, "rel_tol": 1e-09}constants.d2{"value": 2.32593, "abs_tol": 5e-06}constants.A2{"value": 0.577, "abs_tol": 0.0005}r0004centred process, sigma = (USL - LSL)/6: Cp = Cpk = 1, ppm = 1e6 erfc(3/sqrt 2) = 2699.796 (textbook 2700), ARL = 1/erfc(3/sqrt 2) = 370.4; closed forms, rel 1e-6passed
cp1 ± 1e-091lockedunder 0.01 % of the tolerance usedcpk1 ± 1e-091lockedunder 0.01 % of the tolerance usedppm_expected2699.8 ± 0.00272699.8lockedunder 0.01 % of the tolerance usedfalse_alarm_rate0.0026998 ± 2.7e-120.0026998lockedunder 0.01 % of the tolerance usedarl_in_control370.398 ± 3.7e-07370.398lockedunder 0.01 % of the tolerance usedr0005six sigma with a 1.5 sigma shift (Motorola): Cp = 2, Cpk = 1.5, ppm = 1e6 (Q(4.5) + Q(7.5)) = 3.3977 (textbook 3.4); closed forms, rel 1e-6passed
cp2 ± 2e-092lockedunder 0.01 % of the tolerance usedcpk1.5 ± 1.5e-091.5lockedunder 0.01 % of the tolerance usedppm_expected3.39767 ± 3.4e-063.39767lockedunder 0.01 % of the tolerance usedfraction_outside_expected3.39767e-06 ± 3.4e-123.39767e-06lockedunder 0.01 % of the tolerance usedr0006I-MR by hand on 1,3,2,4,3: mean 2.6, mean MR 1.5, sigma = 1.5 sqrt(pi)/2, UCL = 2.6 + 3 sigma, MR UCL = 1.5 (1 + 3 sqrt(pi/2 - 1)), s = sqrt(1.3); exact arithmetic, rel 1e-8 (d2, d3 by quadrature)passed
chart= i_mri_mrlockedexact matchmean2.6 ± 2.6e-122.6lockedunder 0.01 % of the tolerance useddispersion_mean1.5 ± 1.5e-121.5lockedunder 0.01 % of the tolerance usedsigma_within1.32934 ± 1.3e-081.32934lockedunder 0.01 % of the tolerance usedlocation_ucl6.58802 ± 6.6e-086.58802lockedunder 0.01 % of the tolerance usedlocation_lcl-1.38802 ± 1.4e-08-1.38802lockedunder 0.01 % of the tolerance useddispersion_ucl4.8998 ± 4.9e-084.8998lockedunder 0.01 % of the tolerance usedsigma_overall1.14018 ± 1.1e-121.14018lockedunder 0.01 % of the tolerance usedin_control= truetruelockedexact matchr0007X-bar R by hand on four subgroups (-1, 1), specs -6..6: sigma_within = R/d2 = sqrt(pi), Cp = Cpk = 2/sqrt(pi), s = sqrt(8/7), Pp = 2 sqrt(7/8), UCL = 3 sqrt(pi/2), R UCL = 2 (1 + 3 sqrt(pi/2 - 1)); exact arithmetic, rel 1e-8passed
chart= xbar_rxbar_rlockedexact matchsigma_within1.77245 ± 1.8e-081.77245lockedunder 0.01 % of the tolerance usedcp1.12838 ± 1.1e-081.12838lockedunder 0.01 % of the tolerance usedcpk1.12838 ± 1.1e-081.12838lockedunder 0.01 % of the tolerance usedpp1.87083 ± 1.9e-121.87083lockedunder 0.01 % of the tolerance usedppk1.87083 ± 1.9e-121.87083lockedunder 0.01 % of the tolerance usedlocation_ucl3.75994 ± 3.8e-083.75994lockedunder 0.01 % of the tolerance useddispersion_ucl6.53306 ± 6.5e-086.53306lockedunder 0.01 % of the tolerance usedppm_observed00lockedr0008rules by construction, standards mean 0 sigma 1: a 4 sigma spike gives 1 point beyond 3 sigma and 2 moving ranges of 4 above (d2 + 3 d3) = 3.686; then 8 points at +0.5 sigma give one run of 8 (Western Electric)passed
in_control= falsefalselockedexact matchrule_counts.beyond_limits= 1misseddiffersrule_counts.dispersion_beyond_limits= 2misseddiffersrule_counts.run_same_side= 1misseddiffersrule_counts.two_of_three_beyond_2_sigma= 0misseddiffersrule_counts.four_of_five_beyond_1_sigma= 0misseddiffersdispersion_ucl3.68589 ± 3.7e-083.68589lockedunder 0.01 % of the tolerance used
Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.
Inputs
| Name | Unit | Default | Meaning |
|---|---|---|---|
data | The measurements: a list of subgroups (each an inner list of equal length), or a flat list cut into subgroups of subgroup_size. Leave out to get the constants (and, with process_mean and process_sigma, the capability of a described process). | ||
data_unit | 1 | Unit of the measurements, the specification limits and the process mean and sigma (mm, um, g, ...). Only recorded and passed on to the readings. | |
subgroup_size | 1 | 1 | Parts measured together, used to cut a flat data list; 1 charts individuals. Without data: the n of the constants. |
chart | auto | auto: i_mr for single values, xbar_r for subgroups up to 10, xbar_s above. | |
rules | western_electric | western_electric: beyond limits, 2 of 3 beyond 2 sigma, 4 of 5 beyond 1 sigma, 8 in a row on one side. nelson adds trend of 6, 14 alternating, 15 within 1 sigma, 8 beyond 1 sigma on both sides, and takes 9 in a row. Every set also flags the dispersion chart beyond its limits. | |
limit_sigmas | 1 | 3 | Control limits at this many standard deviations of the plotted statistic. |
lsl | Lower specification limit (optional). | ||
usl | Upper specification limit (optional). | ||
process_mean | Known (standard) process mean: centres the chart. Without data, the mean of the described process. | ||
process_sigma | Known (standard) process standard deviation, greater than 0: sets the limits. Without data, the sigma of the described process. | ||
constants_table_max_n | 1 | 0 | If 2 or more, also tabulate d2, d3, c4, A2, A3, B3-B6, D1-D4, E2 for n = 2 up to this, at limit_sigmas (out/constants.csv). |
Readings
| Name | Unit | Meaning |
|---|---|---|
data_unit | 1 | The unit the location readings are in. |
mode | 1 | "data" (charted measurements) or "model" (constants and a described process). |
chart | 1 | |
subgroup_size | 1 | |
subgroups_n | 1 | |
observations_n | 1 | |
limit_sigmas | 1 | |
false_alarm_rate | 1 | Probability that one in-control point falls beyond the limits, 2 (1 - Phi(L)). |
arl_in_control | 1 | Average run length between false alarms, in points. |
mean | Grand mean of the data (or the described process mean). | |
sigma_within | Mean range / d2, mean s / c4, or mean moving range / d2(2). | |
sigma_overall | Sample standard deviation of every observation (n - 1). | |
dispersion_mean | ||
location_cl | ||
location_lcl | ||
location_ucl | ||
dispersion_cl | ||
dispersion_lcl | ||
dispersion_ucl | ||
in_control | 1 | true when no rule fired; null without data. |
signals_n | 1 | |
signal_points_n | 1 | |
signals | 1 | |
signals_detail | 1 | |
rule_counts | 1 | |
cp | 1 | (USL - LSL) / 6 sigma_within. |
cpk | 1 | min(USL - mean, mean - LSL) / 3 sigma_within. |
cpu | 1 | |
cpl | 1 | |
pp | 1 | (USL - LSL) / 6 sigma_overall. |
ppk | 1 | As Cpk with sigma_overall. |
sigma_level | 1 | 3 Cpk: the distance from the mean to the nearer specification limit in sigma_within. |
fraction_outside_expected | 1 | ppm_expected / 1e6: the fraction of parts expected outside the specification, the number to chain into other runs. |
ppm_expected | No unit the kernel can check (ppm is not in its table): read it as a count per million. Parts per million expected outside the specification, normal with the mean and sigma_within (a count per million parts, not a fraction). | |
ppm_below_lsl | No unit the kernel can check (ppm is not in its table): read it as a count per million. Parts per million expected below LSL. | |
ppm_above_usl | No unit the kernel can check (ppm is not in its table): read it as a count per million. Parts per million expected above USL. | |
ppm_expected_overall | No unit the kernel can check (ppm is not in its table): read it as a count per million. Parts per million expected outside, with sigma_overall. | |
ppm_observed | No unit the kernel can check (ppm is not in its table): read it as a count per million. Parts per million of the measurements that fall outside the specification. | |
constants | 1 | d2, d3, c4 (by integration), c4_gamma (Gamma-function check), and A2, A3, B3-B6, D1-D4, E2 at limit_sigmas for the subgroup size. |
constants_table | 1 | |
points | 1 | |
points_truncated | 1 | |
notes | 1 |
Try the call
Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.