GitHub

Classical and Generalized Process Capability Indices for Any Distribution

Overview

ProcessCapabilityR computes Process Capability Indices (PCIs) for any quality characteristic — not just the normal distribution — by letting users supply the characteristic's PDF and CDF directly.

Features

  • 11 classical indices: Cp, Cpk, Cpu, Cpl, Cpm, Cpmk, Pp, Ppk, Ppu, Ppl, Z (sigma level)
  • Generalized index Cpy (Maiti, Saha & Nanda, 2010) for any continuous or discrete distribution
  • Bootstrap confidence intervals — percentile and BCa methods, parametric or nonparametric
  • Sensitivity grids across σ, s, p₀ values at multiple significance levels
  • ggplot2 visualisation of sensitivity sweeps with confidence bands

Installation

# Install from GitHub
# devtools::install_github("shikhartyagi/ProcessCapabilityR")
# Or install locally from source
devtools::install("path/to/ProcessCapabilityR")
# Load the package
library(ProcessCapabilityR)

Quick Start

Classical Indices (Normal Process)

library(ProcessCapabilityR)
# Process: USL = 63, LSL = 57, μ = 60, σ = 1 (centered)
cp(LSL = 57, USL = 63, sigma = 1)                        # 1.0
cpk(LSL = 57, USL = 63, mu = 60, sigma = 1)              # 1.0
cpm(LSL = 57, USL = 63, mu = 60, sigma = 1, target = 60) # 1.0
z_level(LSL = 57, USL = 63, mu = 60, sigma = 1)          # 3.0
# Or use the generic interface
pci("Cp",  LSL = 57, USL = 63, sigma = 1)
pci("Cpk", LSL = 57, USL = 63, mu = 60, sigma = 1)
# Performance indices (long-term)
pp(LSL = 57, USL = 63, s = 1.5)                          # 0.667
ppk(LSL = 57, USL = 63, xbar = 60, s = 1.5)              # 0.667

Generalized Cpy (Non-Normal Distribution)

# Define a Weibull distribution
dist_weibull <- pci_dist(
  pdf    = function(x, shape, scale) dweibull(x, shape, scale),
  cdf    = function(x, shape, scale) pweibull(x, shape, scale),
  params = list(shape = 2, scale = 10),
  support = c(0, 50)
)
# Compute Cpy with desired yield p₀ = 0.95
pci("Cpy", dist = dist_weibull, LSL = 2, USL = 20, p0 = 0.95)

Bootstrap Confidence Intervals

dist_norm <- pci_dist_normal(mean = 60, sd = 1)
ci <- pci_ci("Cp", dist = dist_norm, n = 30,
             LSL = 57, USL = 63, alpha = 0.05, B = 2000)
print(ci)

Sensitivity Grid & Plot

grid <- pci_grid("Cp",
                 dist = pci_dist_normal(60, 1),
                 LSL = 57, USL = 63,
                 sigma_vals = seq(0.5, 2.0, by = 0.1),
                 mu = 60,
                 alpha_vals = c(0.10, 0.05, 0.01),
                 n = 30, B = 500)
plot(grid, x_axis = "sigma")

Cpy Sensitivity Grid

grid_cpy <- pci_grid("Cpy",
                     dist = pci_dist_normal(60, 1),
                     LSL = 57, USL = 63,
                     p0_vals = c(0.90, 0.95, 0.99),
                     alpha_vals = c(0.10, 0.05, 0.01),
                     n = 30, B = 500)
plot(grid_cpy, x_axis = "p0")

Available Indices

Index Formula Description
Cp (USL − LSL) / (6σ) Process potential
Cpk min[(USL − μ)/(3σ), (μ − LSL)/(3σ)] Capability with centering
Cpu (USL − μ) / (3σ) Upper capability
Cpl (μ − LSL) / (3σ) Lower capability
Cpm (USL − LSL) / (6√(σ² + (μ−T)²)) Taguchi (target-sensitive)
Cpmk min[(USL−μ), (μ−LSL)] / (3√(σ²+(μ−T)²)) Modified Taguchi
Pp (USL − LSL) / (6s) Long-term performance
Ppk min[(USL − x̄)/(3s), (x̄ − LSL)/(3s)] Performance with centering
Ppu (USL − x̄) / (3s) Upper performance
Ppl (x̄ − LSL) / (3s) Lower performance
Z min[(USL − μ)/σ, (μ − LSL)/σ] Sigma level
Cpy [F(USL)−F(LSL)] / [F(UDL)−F(LDL)] Generalized (any distribution)

References

  • Juran, J.M. (1974). Quality Control Handbook (3rd ed.). McGraw-Hill.
  • Kane, V.E. (1986). Process capability indices. Journal of Quality Technology, 18(1), 41–52.
  • Chan, L.K., Cheng, S.W., & Spiring, F.A. (1988). A new measure of process capability: Cpm. Journal of Quality Technology, 20(3), 162–175.
  • Pearn, W.L., Kotz, S., & Johnson, N.L. (1992). Distributional and inferential properties of process capability indices. Journal of Quality Technology, 24(4), 216–231.
  • Harry, M., & Schroeder, R. (2000). Six Sigma: The Breakthrough Management Strategy. Doubleday.
  • Kotz, S., & Johnson, N.L. (2002). Process capability indices — a review, 1992–2000. Journal of Quality Technology, 34(1), 2–19.
  • AIAG (2005). Statistical Process Control (SPC) Reference Manual (2nd ed.).
  • Maiti, S.S., Saha, M., & Nanda, A.K. (2010). On generalizing process capability indices. Quality Technology & Quantitative Management, 7(3), 279–300.
  • Montgomery, D.C. (2020). Introduction to Statistical Quality Control (8th ed.). Wiley.

Authors

License

MIT © 2025 Shikhar Tyagi, Sumit Kumar, Vrijesh Tripathi

Read the original on github.com ↗