| Title: | Generalized Process Capability Indices via EM Algorithm under Progressive Type-II Censoring |
|---|---|
| Description: | Implements the Expectation-Maximization (EM) algorithm of Dempster, Laird, and Rubin (1977) <doi:10.1111/j.2517-6161.1977.tb01600.x> for parameter estimation under progressive Type-II censored data (Balakrishnan and Aggarwala (2000) <doi:10.1007/978-1-4612-1186-0>) and computes Generalized Process Capability Indices (GPCIs). Uses the 'UniCensorEM' package for EM estimation. Supports classical and generalized capability indices including Cpy (Maiti et al. (2010) <doi:10.1080/16843703.2010.11673233>), Cp, Cpk, Cpu, Cpl, Cpm, Cpmk, Spmk (Dey and Saha (2019) <doi:10.1007/s41872-019-00081-4>), CpTk (Saha et al. (2018) <doi:10.1080/21681015.2018.1437793>), Cpc, CNpmc (Alotaibi et al. (2022) <doi:10.1155/2022/3135264>), CNpmkc (Saha et al. (2024) <doi:10.1142/S021853932450013X>), and CNpk (Saha et al. (2022) <doi:10.1080/02664763.2021.1971632>). Computes point estimates, bias, mean squared error, risk, Heidelberger and Welch convergence diagnostics, convergence probability, and bootstrap confidence intervals at 90 percent, 95 percent, and 99 percent levels. Accommodates user-defined probability density or mass functions, cumulative distribution functions, and survival functions. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>) |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-08 10:12:25 UTC |
| Source: | https://github.com/cran/gpciEMprogII |
Computes parametric or non-parametric bootstrap confidence intervals for Generalized Process Capability Indices and model parameters under progressive Type-II censoring using EM algorithm estimation. Provides bootstrap CIs at 90%, 95%, and 99% levels, plus estimates of bias, MSE, risk, Heidelberger-Welch convergence diagnostics, and convergence probability.
boot_ci_prog_em( fit, B = 1000, alpha = c(0.1, 0.05, 0.01), method = c("percentile", "normal", "basic", "BCp", "BCa", "studentized"), type = c("parametric", "nonparametric"), max_iter = 1000, tol = 1e-08 ) gpc_boot_em( fit, B = 1000, alpha = c(0.1, 0.05, 0.01), method = c("percentile", "normal", "basic", "BCp", "BCa", "studentized"), type = c("parametric", "nonparametric"), max_iter = 1000, tol = 1e-08 )boot_ci_prog_em( fit, B = 1000, alpha = c(0.1, 0.05, 0.01), method = c("percentile", "normal", "basic", "BCp", "BCa", "studentized"), type = c("parametric", "nonparametric"), max_iter = 1000, tol = 1e-08 ) gpc_boot_em( fit, B = 1000, alpha = c(0.1, 0.05, 0.01), method = c("percentile", "normal", "basic", "BCp", "BCa", "studentized"), type = c("parametric", "nonparametric"), max_iter = 1000, tol = 1e-08 )
fit |
A |
B |
Number of bootstrap replicates (default 1000). |
alpha |
Numeric vector of significance levels (default
|
method |
CI method: |
type |
Resampling type: |
max_iter |
Maximum EM iterations per bootstrap (default 1000). |
tol |
Convergence tolerance per bootstrap (default 1e-8). |
An object of class "gpc_em_ci" containing:
Data frame of confidence intervals.
Data frame of parameter performance metrics (estimate, SE, bias, MSE, risk).
Data frame of index performance metrics.
Data frame with Heidelberger-Welch diagnostics and convergence probability for each index.
Matrix of bootstrap parameter replicates.
Matrix of bootstrap index replicates.
Original fitted object.
Number of bootstrap replicates.
my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fit <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0) ci <- boot_ci_prog_em(fit, B = 100, alpha = c(0.10, 0.05, 0.01), method = "percentile") print(ci)my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fit <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0) ci <- boot_ci_prog_em(fit, B = 100, alpha = c(0.10, 0.05, 0.01), method = "percentile") print(ci)
Computes classical and generalized Process Capability Indices (PCIs) for progressive Type-II censored data using model parameter estimates obtained from the EM algorithm.
capability_prog_em( x = NULL, r_removals = NULL, distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpu", "Cpl", "Cpm", "Cpmk", "Spmk", "CpTk", "Cpc", "CNpmc"), u = 1, v = 1, mode = c("moments", "quantile"), fit = TRUE, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL, max_iter = 1000, tol = 1e-08 ) gpc_em_fit( x = NULL, r_removals = NULL, distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpu", "Cpl", "Cpm", "Cpmk", "Spmk", "CpTk", "Cpc", "CNpmc"), u = 1, v = 1, mode = c("moments", "quantile"), fit = TRUE, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL, max_iter = 1000, tol = 1e-08 )capability_prog_em( x = NULL, r_removals = NULL, distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpu", "Cpl", "Cpm", "Cpmk", "Spmk", "CpTk", "Cpc", "CNpmc"), u = 1, v = 1, mode = c("moments", "quantile"), fit = TRUE, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL, max_iter = 1000, tol = 1e-08 ) gpc_em_fit( x = NULL, r_removals = NULL, distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpu", "Cpl", "Cpm", "Cpmk", "Spmk", "CpTk", "Cpc", "CNpmc"), u = 1, v = 1, mode = c("moments", "quantile"), fit = TRUE, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL, max_iter = 1000, tol = 1e-08 )
x |
Numeric vector of observed failure times under progressive
Type-II censoring. Can be |
r_removals |
Numeric vector of removal counts (censoring scheme R). |
distribution |
A |
USL |
Upper Specification Limit. |
LSL |
Lower Specification Limit. |
target |
Process target (defaults to |
indices |
Character vector of capability indices to compute.
Choices: |
u |
Weight parameter for |
v |
Weight parameter for |
mode |
Mode of evaluation: |
fit |
Logical. If |
C0 |
Cost function parameter (default 1). |
C1 |
Cost function parameter (default 0). |
C2 |
Cost function parameter (default 1). |
tolerance_t |
Tolerance length (defaults to |
P0 |
Desired conformance level for |
LDL |
Lower Desired Limit for |
UDL |
Upper Desired Limit for |
max_iter |
Maximum EM iterations (default 1000). |
tol |
Convergence tolerance for EM (default 1e-8). |
An object of class c("gpc_em_fit", "gpcifit") containing:
Observed data (if provided).
Removal scheme (if provided).
Fitted distribution object.
Specification limits and target.
Names of computed indices.
Named numeric vector of index values.
Estimated nonconforming proportion.
Computation mode used.
List of all computation options.
my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) cap <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0) print(cap)my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) cap <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0) print(cap)
Coef Method for Progressive Type-II GPCI EM Fit
## S3 method for class 'gpc_em_fit' coef(object, what = c("indices", "parameters"), ...)## S3 method for class 'gpc_em_fit' coef(object, what = c("indices", "parameters"), ...)
object |
Object of class |
what |
Extract |
... |
Additional arguments (currently unused). |
Named numeric vector of index values or parameter estimates.
Evaluates standard error, MSE, bias, risk, and empirical coverage probability for parameters and GPCIs under progressive Type-II censoring using the EM algorithm with bootstrap CIs.
eval_performance_em( distribution, r_removals, USL, LSL, target = (USL + LSL)/2, true_indices = NULL, M = 100, B = 200, alpha = c(0.1, 0.05, 0.01), max_iter = 1000, tol = 1e-08 ) gpc_sim_em( distribution, r_removals, USL, LSL, target = (USL + LSL)/2, true_indices = NULL, M = 100, B = 200, alpha = c(0.1, 0.05, 0.01), max_iter = 1000, tol = 1e-08 )eval_performance_em( distribution, r_removals, USL, LSL, target = (USL + LSL)/2, true_indices = NULL, M = 100, B = 200, alpha = c(0.1, 0.05, 0.01), max_iter = 1000, tol = 1e-08 ) gpc_sim_em( distribution, r_removals, USL, LSL, target = (USL + LSL)/2, true_indices = NULL, M = 100, B = 200, alpha = c(0.1, 0.05, 0.01), max_iter = 1000, tol = 1e-08 )
distribution |
A |
r_removals |
Progressive censoring scheme vector R. |
USL |
Upper Specification Limit. |
LSL |
Lower Specification Limit. |
target |
Process target (default midpoint). |
true_indices |
Optional named vector of true index values. |
M |
Number of Monte Carlo simulation runs (default 100). |
B |
Number of bootstrap iterations per run (default 200). |
alpha |
Significance levels (default |
max_iter |
Maximum EM iterations (default 1000). |
tol |
Convergence tolerance (default 1e-8). |
A list containing coverage probabilities, M, B, true parameters, and true index values.
dist_true <- dist_weibull(shape = 2, scale = 5) r_scheme <- c(2, 0, 3, 0, 1) eval_res <- eval_performance_em(dist_true, r_scheme, USL = 10, LSL = 0, M = 5, B = 20) print(eval_res)dist_true <- dist_weibull(shape = 2, scale = 5) r_scheme <- c(2, 0, 3, 0, 1) eval_res <- eval_performance_em(dist_true, r_scheme, USL = 10, LSL = 0, M = 5, B = 20) print(eval_res)
Fits process distribution parameters to progressive Type-II censored
data using the Expectation-Maximization (EM) algorithm via the
UniCensorEM package.
fit_prog_ty2_em( x, r_removals, distribution, start = NULL, max_iter = 1000, tol = 1e-08, ... )fit_prog_ty2_em( x, r_removals, distribution, start = NULL, max_iter = 1000, tol = 1e-08, ... )
x |
Numeric vector of observed order statistics (sorted ascending). |
r_removals |
Integer vector of progressive removal counts
(censoring scheme R). Must have the same length as |
distribution |
A |
start |
Optional vector of initial parameter values. If |
max_iter |
Maximum number of EM iterations (default 1000). |
tol |
Convergence tolerance (default 1e-8). |
... |
Additional arguments (currently unused). |
The input distribution object with updated parameter estimates
and attributes: "em_fit" (the raw emfit object),
"converged" (logical), "iterations" (integer),
and "loglik" (numeric).
my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fitted <- fit_prog_ty2_em(x = x, r_removals = r, distribution = my_dist)my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fitted <- fit_prog_ty2_em(x = x, r_removals = r, distribution = my_dist)
Extracts or computes a single capability index from a fitted object.
gpc_index_em(fit, index)gpc_index_em(fit, index)
fit |
A |
index |
Character name of the index to extract or compute. |
Numeric value of the specified index.
my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fit <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0, fit = FALSE) gpc_index_em(fit, "Cp")my_dist <- dist_weibull(shape = 1, scale = 1) x <- c(0.5, 1.2, 2.1, 3.4, 4.8) r <- c(1, 0, 2, 0, 1) fit <- capability_prog_em(x = x, r_removals = r, distribution = my_dist, USL = 6, LSL = 0, fit = FALSE) gpc_index_em(fit, "Cp")
Builds a distribution specification object for parameter estimation using the EM algorithm and Generalized Process Capability Indices (GPCIs) under progressive Type-II censored data.
make_gpc_dist( name, pdf, cdf, surv = NULL, quantile = NULL, start, param_names = paste0("param", seq_along(start)), support = c(0, Inf) )make_gpc_dist( name, pdf, cdf, surv = NULL, quantile = NULL, start, param_names = paste0("param", seq_along(start)), support = c(0, Inf) )
name |
Character string giving the name of the distribution. |
pdf |
Function |
cdf |
Function |
surv |
Function |
quantile |
Optional function |
start |
Vector of initial parameter values for estimation. |
param_names |
Character vector of parameter names. |
support |
Numeric vector of length 2 giving the domain support
of the distribution (default |
An object of class "gpc_dist".
pdf_exp <- function(x, theta) dexp(x, rate = theta[1]) cdf_exp <- function(x, theta) pexp(x, rate = theta[1]) surv_exp <- function(x, theta) 1 - pexp(x, rate = theta[1]) my_dist <- make_gpc_dist("Exponential", pdf_exp, cdf_exp, surv_exp, start = c(1), param_names = "rate")pdf_exp <- function(x, theta) dexp(x, rate = theta[1]) cdf_exp <- function(x, theta) pexp(x, rate = theta[1]) surv_exp <- function(x, theta) 1 - pexp(x, rate = theta[1]) my_dist <- make_gpc_dist("Exponential", pdf_exp, cdf_exp, surv_exp, start = c(1), param_names = "rate")
Built-in helper functions creating "gpc_dist" objects for
standard process distributions.
dist_normal(mean = 0, sd = 1) dist_weibull(shape = 1, scale = 1) dist_gamma(shape = 1, rate = 1) dist_exp_exp(alpha = 1, lambda = 1) dist_logistic_exp(alpha = 1, lambda = 1)dist_normal(mean = 0, sd = 1) dist_weibull(shape = 1, scale = 1) dist_gamma(shape = 1, rate = 1) dist_exp_exp(alpha = 1, lambda = 1) dist_logistic_exp(alpha = 1, lambda = 1)
mean |
Initial mean for Normal distribution. |
sd |
Initial standard deviation for Normal distribution. |
shape |
Initial shape parameter. |
scale |
Initial scale parameter. |
rate |
Initial rate parameter. |
alpha |
Initial alpha shape parameter. |
lambda |
Initial lambda scale parameter. |
A "gpc_dist" object.
d_norm <- dist_normal() d_weib <- dist_weibull()d_norm <- dist_normal() d_weib <- dist_weibull()
Print Method for Bootstrap CIs
## S3 method for class 'gpc_em_ci' print(x, ...)## S3 method for class 'gpc_em_ci' print(x, ...)
x |
Object of class |
... |
Additional arguments (currently unused). |
The input object, invisibly.
Print Method for Progressive Type-II GPCI EM Fit
## S3 method for class 'gpc_em_fit' print(x, ...)## S3 method for class 'gpc_em_fit' print(x, ...)
x |
Object of class |
... |
Additional arguments (currently unused). |
The input object, invisibly.
Summary Method for Bootstrap CIs
## S3 method for class 'gpc_em_ci' summary(object, ...)## S3 method for class 'gpc_em_ci' summary(object, ...)
object |
Object of class |
... |
Additional arguments (currently unused). |
The input object, invisibly.
Summary Method for Progressive Type-II GPCI EM Fit
## S3 method for class 'gpc_em_fit' summary(object, ...)## S3 method for class 'gpc_em_fit' summary(object, ...)
object |
Object of class |
... |
Additional arguments (currently unused). |
The input object, invisibly.