ProcessCapabilityR

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

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

Authors

License

MIT © 2025 Shikhar Tyagi, Sumit Kumar, Vrijesh Tripathi