algo-mfg-cpk

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Cpk Process Capability Index

Cpk过程能力指数

Overview

概述

Cpk measures how well a process fits within specification limits, accounting for both variation (spread) and centering. Cpk = min((USL - μ) / 3σ, (μ - LSL) / 3σ). Cpk ≥ 1.33 is typically required; Cpk ≥ 1.67 for critical characteristics. Unlike Cp, Cpk penalizes off-center processes.
Cpk用于衡量过程贴合规格限的程度,同时考虑变异(离散度)和中心度。计算公式为:Cpk = min((USL - μ) / 3σ, (μ - LSL) / 3σ)。通常要求Cpk ≥ 1.33;对于关键特性,Cpk需≥1.67。与Cp不同,Cpk会对偏离中心的过程进行惩罚。

When to Use

使用场景

Trigger conditions:
  • Assessing whether a manufacturing process can meet customer specifications
  • Comparing capability across processes, machines, or time periods
  • Qualifying a process for production readiness
When NOT to use:
  • When the process is not in statistical control (stabilize first with SPC)
  • For non-normal distributions without transformation
触发条件:
  • 评估制造过程是否能满足客户规格要求
  • 比较不同过程、机器或时间段的能力
  • 确认过程是否具备生产就绪条件
不适用场景:
  • 过程未处于统计受控状态(需先通过SPC稳定过程)
  • 未进行转换的非正态分布数据

Algorithm

算法

IRON LAW: Cpk Is Only Valid for a STABLE, IN-CONTROL Process
Computing Cpk on an unstable process gives a meaningless number.
The process MUST be in statistical control (per SPC charts) before
capability analysis. An unstable process with Cpk=2.0 today may
produce defects tomorrow when it shifts.
IRON LAW: Cpk仅对稳定、受控的过程有效
在不稳定的过程上计算Cpk会得到无意义的数值。
在进行能力分析前,过程必须处于统计受控状态(符合SPC图表的稳定性要求)。一个当前Cpk=2.0的不稳定过程,可能在发生偏移后的第二天就产生缺陷。

Phase 1: Input Validation

阶段1:输入验证

Collect: 100+ measurements from a stable process. Determine: USL, LSL (customer specifications). Verify process is in control (SPC charts show stability). Gate: Process in control, specifications defined, 100+ data points.
收集:来自稳定过程的100+个测量数据。确定:USL(规格上限)、LSL(规格下限)(客户规格要求)。验证过程处于受控状态(SPC图表显示稳定性)。 准入条件: 过程受控、规格已定义、数据点≥100。

Phase 2: Core Algorithm

阶段2:核心算法

  1. Compute process mean: μ = Σxᵢ / n
  2. Compute process standard deviation: σ = estimated from R-bar/d₂ or S-bar/c₄ (within-subgroup) — NOT overall std dev
  3. Cp = (USL - LSL) / 6σ (potential capability, ignoring centering)
  4. Cpk = min((USL - μ) / 3σ, (μ - LSL) / 3σ) (actual capability)
  5. Estimate PPM defective from Cpk (e.g., Cpk=1.33 → ~63 PPM)
  1. 计算过程均值:μ = Σxᵢ / n
  2. 计算过程标准差:σ = 通过R-bar/d₂或S-bar/c₄(组内)估算——而非整体标准差
  3. Cp = (USL - LSL) / 6σ(潜在能力,不考虑中心度)
  4. Cpk = min((USL - μ) / 3σ, (μ - LSL) / 3σ)(实际能力)
  5. 根据Cpk估算PPM缺陷率(例如:Cpk=1.33 → 约63 PPM)

Phase 3: Verification

阶段3:验证

Check: Cp vs Cpk difference indicates centering issue (Cp >> Cpk = off-center). Distribution is approximately normal (histogram, normality test). Gate: Capability computed, centering assessed, normality verified.
检查:Cp与Cpk的差值表明存在中心度问题(Cp远大于Cpk = 过程偏离中心)。分布近似正态(直方图、正态性检验)。 准入条件: 已计算能力指数、已评估中心度、已验证正态性。

Phase 4: Output

阶段4:输出

Return capability indices with defect rate estimates.
返回能力指数及缺陷率估算值。

Output Format

输出格式

json
{
  "capability": {"cp": 1.8, "cpk": 1.45, "ppm_defective": 27},
  "centering": {"mean": 50.2, "target": 50.0, "offset_pct": 0.4},
  "specs": {"usl": 55, "lsl": 45, "target": 50},
  "metadata": {"samples": 200, "sigma_method": "rbar_d2", "normality_p": 0.35}
}
json
{
  "capability": {"cp": 1.8, "cpk": 1.45, "ppm_defective": 27},
  "centering": {"mean": 50.2, "target": 50.0, "offset_pct": 0.4},
  "specs": {"usl": 55, "lsl": 45, "target": 50},
  "metadata": {"samples": 200, "sigma_method": "rbar_d2", "normality_p": 0.35}
}

Examples

示例

Sample I/O

输入输出示例

Input: USL=55, LSL=45, μ=50.2, σ=1.5 Expected: Cp = (55-45)/(6×1.5) = 1.11. Cpk = min((55-50.2)/4.5, (50.2-45)/4.5) = min(1.07, 1.16) = 1.07. Below 1.33 target.
输入: USL=55, LSL=45, μ=50.2, σ=1.5 预期结果: Cp = (55-45)/(6×1.5) = 1.11。Cpk = min((55-50.2)/4.5, (50.2-45)/4.5) = min(1.07, 1.16) = 1.07。低于1.33的目标值。

Edge Cases

边缘情况

InputExpectedWhy
μ exactly at targetCp = CpkPerfectly centered
μ outside specsCpk < 0Process mean beyond specification limit
One-sided spec onlyUse Cpk for that side onlye.g., surface finish has only USL
输入预期结果原因
μ恰好等于目标值Cp = Cpk完全居中
μ超出规格范围Cpk < 0过程均值超出规格限
仅单侧规格仅针对该侧使用Cpk例如:表面光洁度仅存在USL

Gotchas

注意事项

  • σ estimation method: Use within-subgroup σ (R̄/d₂), NOT overall σ. Overall σ includes between-subgroup variation that inflates σ and understates Cpk.
  • Non-normal data: Cpk assumes normality. For skewed data (surface finish, concentricity), use Box-Cox transformation or non-parametric capability indices.
  • Short-term vs long-term: Cp/Cpk are short-term (within subgroup variation). Pp/Ppk use overall variation (long-term). Customers often want Ppk.
  • Sample size confidence: Cpk from 30 samples has wide confidence intervals. Report confidence intervals alongside point estimates.
  • Cpk ≠ defect-free: Even Cpk=2.0 has a theoretical defect rate (~0.002 PPM). For ultra-critical applications, higher Cpk or process validation is required.
  • σ估算方法:使用组内σ(R̄/d₂),而非整体σ。整体σ包含组间变异,会增大σ值并低估Cpk。
  • 非正态数据:Cpk假设数据呈正态分布。对于偏态数据(如表面光洁度、同心度),可使用Box-Cox转换或非参数能力指数。
  • 短期vs长期:Cp/Cpk是短期指标(基于组内变异)。Pp/Ppk使用整体变异(长期)。客户通常关注Ppk。
  • 样本量置信度:基于30个样本计算的Cpk置信区间较宽。需同时报告置信区间和点估计值。
  • Cpk≠无缺陷:即使Cpk=2.0,理论缺陷率仍约为0.002 PPM。对于超关键应用,需要更高的Cpk或进行过程验证。

Scripts

脚本

ScriptDescriptionUsage
scripts/cpk.py
Compute Cp, Cpk, Cpm, and PPM defective from process data
python scripts/cpk.py --help
Run
python scripts/cpk.py --verify
to execute built-in sanity tests.
脚本描述使用方法
scripts/cpk.py
根据过程数据计算Cp、Cpk、Cpm及PPM缺陷率
python scripts/cpk.py --help
运行
python scripts/cpk.py --verify
可执行内置的完整性测试。

References

参考资料

  • For Cp/Cpk/Pp/Ppk comparison, see
    references/capability-indices.md
  • For non-normal capability analysis, see
    references/non-normal-capability.md
  • 关于Cp/Cpk/Pp/Ppk的对比,详见
    references/capability-indices.md
  • 关于非正态能力分析,详见
    references/non-normal-capability.md