The gpci package provides a distribution-agnostic
framework for calculating Process Capability Indices (PCIs), performing
bootstrap confidence interval estimation, and running bootstrap
cross-validation coverage diagnostics.
This vignette demonstrates standard normal-theory capability analysis.
We simulate a quality characteristic \(X \sim N(10, 1.2^2)\) from a stable process. We set specification limits: * Lower Specification Limit (LSL) = 7 * Upper Specification Limit (USL) = 13 * Target (\(T\)) = 10
We construct a standard normal distribution object and fit it to the data using Maximum Likelihood Estimation (MLE):
# Create standard normal distribution template
dist_norm <- dist_normal()
# Compute capability indices (moment-based and quantile-based)
fit <- capability(
data = process_data,
distribution = dist_norm,
USL = 13,
LSL = 7,
target = 10,
indices = c("Cp", "Cpk", "Cpl", "Cpu", "Cpm", "Cpmk", "Spmk", "Cpc"),
fit = TRUE,
fit_method = "mle",
mode = "moments"
)
# Print results
print(fit)
#> --- Process Capability Analysis (Class: gpcifit) ---
#> Distribution: normal
#> Parameters: mean = 9.8994, sd = 0.9982
#> Spec Limits: LSL = 7 , USL = 13 , Target = 10
#> Mode: moments
#> Expected Nonconforming (p_hat): 0.2785 %
#>
#> Point Estimates of Capability Indices:
#> Cp Cpk Cpl Cpu Cpm Cpmk Spmk Cpc
#> 1.0018 0.9682 0.9682 1.0354 0.9968 0.9634 0.9918 0.9694Next, we compute bootstrap confidence intervals at multiple significance levels (\(\alpha = 0.10, 0.05, 0.01\)) using the percentile bootstrap:
# Calculate CIs
ci <- boot_ci(
fit = fit,
B = 30, # Optimized B for fast vignette generation
alpha = c(0.10, 0.05, 0.01),
method = "percentile",
type = "parametric"
)
# View CI table
print(ci)
#> --- Bootstrap Confidence Intervals ---
#> Bootstrap Type: parametric
#> CI Method: percentile
#> Replicates (B): 30
#>
#> index estimate method type alpha conf_level lower upper width
#> 1 Cp 1.0018 percentile parametric 0.10 90% 0.9113 1.1444 0.2331
#> 2 Cp 1.0018 percentile parametric 0.05 95% 0.9024 1.1452 0.2428
#> 3 Cp 1.0018 percentile parametric 0.01 99% 0.9024 1.1452 0.2428
#> 4 Cpk 0.9682 percentile parametric 0.10 90% 0.8792 1.0990 0.2198
#> 5 Cpk 0.9682 percentile parametric 0.05 95% 0.8689 1.1298 0.2609
#> 6 Cpk 0.9682 percentile parametric 0.01 99% 0.8689 1.1298 0.2609
#> 7 Cpl 0.9682 percentile parametric 0.10 90% 0.8792 1.0990 0.2198
#> 8 Cpl 0.9682 percentile parametric 0.05 95% 0.8689 1.1298 0.2609
#> 9 Cpl 0.9682 percentile parametric 0.01 99% 0.8689 1.1298 0.2609
#> 10 Cpu 1.0354 percentile parametric 0.10 90% 0.9138 1.2011 0.2874
#> 11 Cpu 1.0354 percentile parametric 0.05 95% 0.9042 1.2081 0.3039
#> 12 Cpu 1.0354 percentile parametric 0.01 99% 0.9042 1.2081 0.3039
#> 13 Cpm 0.9968 percentile parametric 0.10 90% 0.9092 1.1312 0.2221
#> 14 Cpm 0.9968 percentile parametric 0.05 95% 0.8979 1.1440 0.2461
#> 15 Cpm 0.9968 percentile parametric 0.01 99% 0.8979 1.1440 0.2461
#> 16 Cpmk 0.9634 percentile parametric 0.10 90% 0.8697 1.0865 0.2168
#> 17 Cpmk 0.9634 percentile parametric 0.05 95% 0.8645 1.1285 0.2640
#> 18 Cpmk 0.9634 percentile parametric 0.01 99% 0.8645 1.1285 0.2640
#> 19 Spmk 0.9918 percentile parametric 0.10 90% 0.9057 1.1189 0.2132
#> 20 Spmk 0.9918 percentile parametric 0.05 95% 0.8934 1.1428 0.2494
#> 21 Spmk 0.9918 percentile parametric 0.01 99% 0.8934 1.1428 0.2494
#> 22 Cpc 0.9694 percentile parametric 0.10 90% 0.4246 3.9652 3.5406
#> 23 Cpc 0.9694 percentile parametric 0.05 95% 0.3821 4.5053 4.1232
#> 24 Cpc 0.9694 percentile parametric 0.01 99% 0.3821 4.5053 4.1232The package provides S3 plot methods for visualizing the process capability:
We can also visualize the bootstrap results: