statistical-process-control
>- Build individuals (I-MR) and X-bar / R control charts and compute basic process capability indices (Cp, Cpk) from quality-control data. Use when monitoring product quality on a stable process. Don't use on data that is strongly autocorrelated (use time-series-process-data-analysis to diagnose fir
- License 许可
- MIT
- 最近更新
- 2026-11-09
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- statistical-process-control
- risk
- low
- source
- https://github.com/jskherman/engg-skills
- license
- MIT
- version
- 1.0.0
- category
- chemical-engineering
- description
- >- Build individuals (I-MR) and X-bar / R control charts and compute basic process capability indices (Cp, Cpk) from quality-control data. Use when monitoring product quality on a stable process. Don't use on data that is strongly autocorrelated (use time-series-process-data-analysis to diagnose fir
- imported_at
- 2026-09-20
- source_path
- skills/statistical-process-control/SKILL.md
- source_repository
- jskherman/engg-skills
- disable-model-invocation
- false
02 资源文件 2
- 参考文档references/control_charts.md172 B
- 脚本scripts/spc.py1.9 KB
03 SKILL.md 正文
Statistical Process Control
Overview
Pure-Python SPC helpers:
- Individuals chart (I-MR) with control limits from the moving range.
- X-bar / R chart with constants from the standard SPC tables.
- Cp and Cpk capability indices.
The chart constants (A2, D3, D4, d2, etc.) are public-domain values widely republished in textbooks; verify against your quality system's standard before regulated reporting.
Prerequisites
uvavailable.
When to Use
- Computing control limits for a new chart.
- Estimating Cp / Cpk for a stable process with bilateral spec limits.
- Sanity-checking a vendor SPC report.
Don't use for
- Autocorrelated process data (
time-series-process-data-analysisfirst). - Left-censored or interval-censored measurements
(
censored-regression). - Attribute (count / defective) charts (p, np, c, u charts not implemented).
- Multivariate SPC (Hotelling T², MEWMA — not implemented).
Utility Scripts
uv run scripts/spc.py individuals --values "12.3,12.5,12.1,12.4,12.6,12.2" --output /tmp/i.jsonuv run scripts/spc.py xbar-r --subgroups "12.3,12.5,12.1|12.4,12.6,12.2|12.2,12.4,12.3" --output /tmp/xr.jsonuv run scripts/spc.py capability --values "12.3,..." --usl 13 --lsl 11 --output /tmp/cap.json
Procedure
- Confirm the process is stable (no obvious shifts, trends, autocorr).
- Pick chart type:
- Individuals (I-MR) for one measurement per sample.
- X-bar / R for rational subgroups of 2-10.
- Compute control limits from a stable baseline window (Phase I); apply in real time (Phase II).
- For capability, ensure the process is centred between spec limits; compute Cp and Cpk.
- Flag out-of-control signals: points beyond 3-sigma, runs of 7+ on the same side of the centre line, etc. (Western Electric rules).
Pitfalls
- Computing Cp / Cpk on a process that is not in statistical control (Phase I diagnostics first).
- Using a one-sigma limit ("99.7% will be in tolerance") when the underlying distribution is not normal.
- Mixing Phase I (limit estimation) and Phase II (limit application) data.
- Treating Cpk as Cp when only one spec limit applies.
- Ignoring the moving-range constant d2 = 1.128 for n = 2.
- Computing X-bar / R with unequal subgroup sizes (the chart constants assume equal n).
- Applying control limits to data with strong autocorrelation; the limits become too tight or too wide.
- Reporting Cp / Cpk with too few data points (< ~30 ideally).
Fallback Strategies
- If autocorrelation is suspected, use
time-series-process-data-analysisto compute ACF; if significant, apply a pre-whitening filter (e.g. ARIMA residuals) before SPC. - If censoring is suspected, see
censored-regression.
Verification
- Run the listed script with representative inputs and an
--outputfile when a deterministic calculation is available. - Confirm the JSON result contains
ok: true, expected units, and no unhandled warnings. - Check result magnitudes against the stated assumptions, references, and a hand calculation or known operating range before reporting them.
References
references/control_charts.md— chart constants and formulas.- Montgomery, Introduction to Statistical Quality Control.
Anti-Patterns
- Reporting "process out of control" from a single point beyond 3-sigma without checking measurement quality.
- Computing Cpk on visibly bimodal data.
- Using SPC limits to decide on a process change instead of as a monitoring tool.
04 同仓库更多 Skills
dei-assessment
Assess diversity, equity, and inclusion with metrics. TRIGGERS - Use when user needs help with dei-assessment related tasks.
dei-action-plan
Create DEI action plans with goals and initiatives. TRIGGERS - Use when user needs help with dei-action-plan related tasks.
culture-fit-assessment
Design culture add assessment processes. TRIGGERS - Use when user needs help with culture-fit-assessment related tasks.
cowork-to-code-bridge
Use an already-installed, independently verified cowork-to-code bridge to run narrowly approved actions on the user's own macOS, Linux, or WSL2 machine through a local file queue.
counter-offer-response
Draft counter-offer responses for retention. TRIGGERS - Use when user needs help with counter-offer-response related tasks.
continuous-feedback-system
Design continuous feedback systems. TRIGGERS - Use when user needs help with continuous-feedback-system related tasks.