| Title: | Generalized Process Capability Indices for Hybrid Type-II Censored Data using MCMC |
|---|---|
| Description: | Implements Bayesian Markov Chain Monte Carlo (MCMC) estimation using Metropolis-Hastings within Gibbs sampler for Generalized Process Capability Indices (GPCIs) under Hybrid Type-II censored lifetime data. Supports classical and generalized capability indices including Cpy, Cp, Cpk, Cpm, Cpmk, Spmk, CpTk, Cpc, CNp, CNpk, CNpm, CNpmk, CNpmc, and CNpmkc. Calculates posterior point estimates, bias, mean squared error (MSE), Bayes risk, Highest Posterior Density (HPD) credible intervals at 90%, 95%, and 99% levels, Heidelberger and Welch's MCMC convergence diagnostics, and coverage probabilities. Accommodates user-defined probability density/mass functions, cumulative distribution functions, and survival functions. Based on methods described in Childs et al. (2003) <doi:10.1080/0266476032000053637>, Kundu and Pradhan (2009) <doi:10.1016/j.spl.2008.09.006>, Saha and Dey (2019) <doi:10.1007/s41872-019-00081-4>, Alotaibi et al. (2022) <doi:10.1155/2022/3135264>, Dey et al. (2017) <doi:10.1080/03610918.2017.1280166>, and Wu et al. (2021) <doi:10.1080/03610918.2021.1963449>. |
| Authors: | Shikhar Tyagi [aut, cre] (ORCID: <https://orcid.org/0000-0003-1606-0844>), Vrijesh Tripathi [aut] |
| Maintainer: | Shikhar Tyagi <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.1.0 |
| Built: | 2026-09-21 09:42:23 UTC |
| Source: | https://github.com/cran/gpcihybridIImcmc |
Extracts posterior mean estimates of capability indices or distribution parameters.
## S3 method for class 'gpci_mcmc' coef(object, what = c("indices", "parameters"), ...)## S3 method for class 'gpci_mcmc' coef(object, what = c("indices", "parameters"), ...)
object |
An object of class |
what |
Character string: |
... |
Additional arguments. |
Named numeric vector of posterior estimates.
Evaluates classical and generalized Process Capability Indices (GPCIs) given process specification limits and a target distribution specification.
compute_gpcis( distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL )compute_gpcis( distribution, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, LDL = LSL, UDL = USL )
distribution |
A |
USL |
Numeric Upper Specification Limit. Must be strictly greater than |
LSL |
Numeric Lower Specification Limit. Must be strictly less than |
target |
Numeric Process Target value (defaults to midpoint |
indices |
Character vector of capability indices to compute. Choices include |
mode |
Character string specifying computation mode: |
u |
Non-negative numeric weight parameter |
v |
Non-negative numeric weight parameter |
C0 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 1. |
C1 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 0. |
C2 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 1. |
tolerance_t |
Positive numeric process tolerance |
P0 |
Desirable conformance probability for |
LDL |
Lower Desired Limit for |
UDL |
Upper Desired Limit for |
Supports moment-based and quantile-based capability indices including:
: Conformance yield capability index .
, , , , , : Classical capability indices.
: Conformance loss and target deviation index.
: Asymmetric target-based index.
: Cost-ratio capability index.
, , , : Quantile-based non-normal indices.
, : Tolerance cost-adjusted capability indices using .
, : Generalized weighted family of capability indices.
A named numeric vector of computed GPCI values.
dist <- dist_weibull(shape = 2, scale = 10) compute_gpcis(dist, USL = 15, LSL = 5, target = 10)dist <- dist_weibull(shape = 2, scale = 10) compute_gpcis(dist, USL = 15, LSL = 5, target = 10)
Constructor to define a continuous or discrete lifetime distribution object for Bayesian MCMC capability analysis under Hybrid Type-II censored data.
define_distribution_hybrid2mcmc( name = "Custom", pdf = NULL, cdf = NULL, sf = NULL, surv = NULL, quantile = NULL, moments = NULL, param_names = NULL, default_params = list(), params = list(), support = c(0, Inf) ) create_custom_dist( name = "Custom", pdf = NULL, cdf = NULL, sf = NULL, surv = NULL, quantile = NULL, moments = NULL, param_names = NULL, default_params = list(), params = list(), support = c(0, Inf) )define_distribution_hybrid2mcmc( name = "Custom", pdf = NULL, cdf = NULL, sf = NULL, surv = NULL, quantile = NULL, moments = NULL, param_names = NULL, default_params = list(), params = list(), support = c(0, Inf) ) create_custom_dist( name = "Custom", pdf = NULL, cdf = NULL, sf = NULL, surv = NULL, quantile = NULL, moments = NULL, param_names = NULL, default_params = list(), params = list(), support = c(0, Inf) )
name |
Character string naming the distribution (e.g. |
pdf |
Function |
cdf |
Function |
sf |
Optional function |
surv |
Alias for |
quantile |
Optional function |
moments |
Optional function |
param_names |
Character vector of parameter names. |
default_params |
Named list or numeric vector of default parameter values. |
params |
Alias for |
support |
Numeric vector of length 2 defining lower and upper bounds of support. Defaults to |
Users can define a distribution by specifying any of its Probability Density/Mass Function (PDF/PMF), Cumulative Distribution Function (CDF), Survival Function (SF), Quantile Function, or Moments. Missing functions are automatically and stably derived numerically.
An S3 object of class "gpci_dist_hybrid2mcmc" and "gpci_dist" containing:
name |
Character string naming the distribution. |
pdf |
Vectorized density/mass function. |
cdf |
Vectorized cumulative distribution function. |
sf |
Vectorized survival function. |
surv |
Alias for |
quantile |
Vectorized quantile function. |
moments |
Function computing mean and variance. |
param_names |
Character vector of parameter names. |
params |
Named list of default parameter values. |
support |
Numeric vector of length 2 specifying support. |
dist_custom <- define_distribution_hybrid2mcmc( name = "CustomExp", pdf = function(x, rate) dexp(x, rate = rate), cdf = function(q, rate) pexp(q, rate = rate), param_names = "rate", params = list(rate = 1) ) print(dist_custom)dist_custom <- define_distribution_hybrid2mcmc( name = "CustomExp", pdf = function(x, rate) dexp(x, rate = rate), cdf = function(q, rate) pexp(q, rate = rate), param_names = "rate", params = list(rate = 1) ) print(dist_custom)
Exponential Distribution Constructor
dist_exponential(rate = 1)dist_exponential(rate = 1)
rate |
Rate parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Exponential distribution.
dist_e <- dist_exponential(rate = 0.5)dist_e <- dist_exponential(rate = 0.5)
Gamma Distribution Constructor
dist_gamma(shape = 1, scale = 1)dist_gamma(shape = 1, scale = 1)
shape |
Shape parameter (> 0). |
scale |
Scale parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Gamma distribution.
dist_g <- dist_gamma(shape = 3, scale = 2)dist_g <- dist_gamma(shape = 3, scale = 2)
Lindley Distribution Constructor
dist_lindley(theta = 1)dist_lindley(theta = 1)
theta |
Parameter theta (> 0). |
A gpci_dist_hybrid2mcmc object for Lindley distribution.
dist_lind <- dist_lindley(theta = 1.5)dist_lind <- dist_lindley(theta = 1.5)
Logistic Distribution Constructor
dist_logistic(location = 0, scale = 1)dist_logistic(location = 0, scale = 1)
location |
Location parameter. |
scale |
Scale parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Logistic distribution.
dist_l <- dist_logistic(location = 0, scale = 1)dist_l <- dist_logistic(location = 0, scale = 1)
Logistic-Exponential Distribution Constructor
dist_logistic_exponential(alpha = 1, lambda = 1)dist_logistic_exponential(alpha = 1, lambda = 1)
alpha |
Shape parameter alpha (> 0). |
lambda |
Scale parameter lambda (> 0). |
A gpci_dist_hybrid2mcmc object for Logistic-Exponential distribution.
dist_le <- dist_logistic_exponential(alpha = 1.2, lambda = 0.8)dist_le <- dist_logistic_exponential(alpha = 1.2, lambda = 0.8)
Log-Logistic Distribution Constructor
dist_loglogistic(shape = 1, scale = 1)dist_loglogistic(shape = 1, scale = 1)
shape |
Shape parameter (> 0). |
scale |
Scale parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Log-Logistic distribution.
dist_ll <- dist_loglogistic(shape = 2, scale = 3)dist_ll <- dist_loglogistic(shape = 2, scale = 3)
Lognormal Distribution Constructor
dist_lognormal(meanlog = 0, sdlog = 1)dist_lognormal(meanlog = 0, sdlog = 1)
meanlog |
Mean on the log scale. |
sdlog |
Standard deviation on the log scale (> 0). |
A gpci_dist_hybrid2mcmc object for Lognormal distribution.
dist_ln <- dist_lognormal(meanlog = 1, sdlog = 0.5)dist_ln <- dist_lognormal(meanlog = 1, sdlog = 0.5)
Normal Distribution Constructor
dist_normal(mean = 0, sd = 1)dist_normal(mean = 0, sd = 1)
mean |
Mean parameter. |
sd |
Standard deviation parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Normal distribution.
dist_n <- dist_normal(mean = 10, sd = 2)dist_n <- dist_normal(mean = 10, sd = 2)
Weibull Distribution Constructor
dist_weibull(shape = 1, scale = 1)dist_weibull(shape = 1, scale = 1)
shape |
Shape parameter (> 0). |
scale |
Scale parameter (> 0). |
A gpci_dist_hybrid2mcmc object for Weibull distribution.
dist_w <- dist_weibull(shape = 2, scale = 5)dist_w <- dist_weibull(shape = 2, scale = 5)
Evaluates the joint log-prior density for a vector or list of parameter values.
eval_log_prior(params, priors = NULL)eval_log_prior(params, priors = NULL)
params |
Named numeric vector or list of distribution parameters. |
priors |
List of prior specifications or a custom log-prior function |
Numeric scalar representing the joint log-prior density value. Returns -Inf for values outside parameter support.
eval_log_prior(c(shape = 2, scale = 5)) pr_spec <- list(rate = list(dist = "gamma", params = c(shape = 1, rate = 1))) eval_log_prior(c(rate = 0.5), priors = pr_spec)eval_log_prior(c(shape = 2, scale = 5)) pr_spec <- list(rate = list(dist = "gamma", params = c(shape = 1, rate = 1))) eval_log_prior(c(rate = 0.5), priors = pr_spec)
Performs goodness-of-fit testing for Hybrid Type-II censored lifetime data using
the gofPHCS package (gofPHCS::gof_test).
gof_test_hybrid2( fit = NULL, x = NULL, r = NULL, tc = NULL, n = NULL, distribution = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 999, seed = NULL, conf.level = 0.95, ... ) gof_test( fit = NULL, x = NULL, r = NULL, tc = NULL, n = NULL, distribution = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 999, seed = NULL, conf.level = 0.95, ... )gof_test_hybrid2( fit = NULL, x = NULL, r = NULL, tc = NULL, n = NULL, distribution = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 999, seed = NULL, conf.level = 0.95, ... ) gof_test( fit = NULL, x = NULL, r = NULL, tc = NULL, n = NULL, distribution = NULL, statistic = "auto", p.method = c("auto", "asymptotic", "montecarlo"), nsim = 999, seed = NULL, conf.level = 0.95, ... )
fit |
Optional |
x |
Numeric vector of observed failure times (required if |
r |
Positive integer target number of failures (required if |
tc |
Positive numeric fixed censoring time (required if |
n |
Positive integer total sample size (required if |
distribution |
A |
statistic |
Character string specifying the test statistic (e.g. |
p.method |
Character string specifying method for calculating p-values: |
nsim |
Positive integer scalar specifying number of Monte Carlo replicates. Defaults to 999. |
seed |
Optional integer seed for reproducibility. Defaults to |
conf.level |
Numeric confidence level for test. Defaults to 0.95. |
... |
Additional arguments passed to |
An S3 object of class "gpci_gof_hybrid2" containing:
fit |
The original |
cens_data |
The |
gof_result |
The returned test result object from |
distribution |
The tested distribution object. |
dist_exp <- dist_exponential(rate = 0.5) x_obs <- c(0.2, 0.5, 0.8, 1.1) gof_res <- gof_test_hybrid2(x = x_obs, r = 3, tc = 1.0, n = 10, distribution = dist_exp, p.method = "montecarlo", nsim = 50) print(gof_res)dist_exp <- dist_exponential(rate = 0.5) x_obs <- c(0.2, 0.5, 0.8, 1.1) gof_res <- gof_test_hybrid2(x = x_obs, r = 3, tc = 1.0, n = 10, distribution = dist_exp, p.method = "montecarlo", nsim = 50) print(gof_res)
Evaluates Generalized Process Capability Indices (GPCIs) under Hybrid Type-II censored lifetime data using Metropolis-Hastings within Gibbs sampler MCMC.
gpci_hybrid2_mcmc( x, r, tc, n, distribution = NULL, pdf = NULL, cdf = NULL, surv = NULL, quantile = NULL, param_names = NULL, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, true_param = NULL, true_gpci = NULL ) gpcihybridIImcmc( x, r, tc, n, distribution = NULL, pdf = NULL, cdf = NULL, surv = NULL, quantile = NULL, param_names = NULL, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, true_param = NULL, true_gpci = NULL )gpci_hybrid2_mcmc( x, r, tc, n, distribution = NULL, pdf = NULL, cdf = NULL, surv = NULL, quantile = NULL, param_names = NULL, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, true_param = NULL, true_gpci = NULL ) gpcihybridIImcmc( x, r, tc, n, distribution = NULL, pdf = NULL, cdf = NULL, surv = NULL, quantile = NULL, param_names = NULL, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, USL, LSL, target = (USL + LSL)/2, indices = c("Cpy", "Cp", "Cpk", "Cpm", "Cpmk", "Spmk", "CNpmc"), mode = c("moments", "quantile"), u = 1, v = 1, C0 = 1, C1 = 0, C2 = 1, tolerance_t = USL - LSL, P0 = 0.9973002, true_param = NULL, true_gpci = NULL )
x |
Numeric vector of observed failure times. Missing values ( |
r |
Positive integer scalar specifying target number of failures. |
tc |
Positive numeric scalar specifying fixed censoring time. |
n |
Positive integer scalar specifying total sample size placed on test ( |
distribution |
Optional |
pdf |
Function |
cdf |
Function |
surv |
Optional function |
quantile |
Optional function |
param_names |
Character vector of parameter names. Default is |
start |
Named numeric vector or list of initial parameter values. |
priors |
List of prior specifications or log-prior function. If |
length_chain |
Positive integer scalar specifying total number of MCMC iterations. Default is 10000. |
burn_in |
Positive integer scalar specifying number of burn-in iterations. Default is 2000. |
thinning |
Positive integer scalar specifying thinning factor. Default is 5. |
USL |
Numeric Upper Specification Limit. Must satisfy |
LSL |
Numeric Lower Specification Limit. Must satisfy |
target |
Numeric Process Target value (default midpoint |
indices |
Character vector of GPCIs to compute. Choices include |
mode |
Character string specifying mode of computation: |
u |
Non-negative numeric weight parameter |
v |
Non-negative numeric weight parameter |
C0 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 1. |
C1 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 0. |
C2 |
Non-negative numeric coefficient for tolerance cost function. Defaults to 1. |
tolerance_t |
Positive numeric process tolerance |
P0 |
Desirable conformance yield for |
true_param |
Optional named numeric vector of true parameter values for bias/MSE validation. If |
true_gpci |
Optional named numeric vector of true GPCI values for bias/MSE validation. If |
Under Hybrid Type-II censoring, units are placed on life test. The experiment terminates at
, where is the pre-fixed target number of failures and is the pre-fixed
censoring time.
The user can supply observed data (x, r, tc, n), custom functions for probability density/mass
(pdf), cumulative distribution (cdf), and survival (surv), along with prior distributions,
chain length, burn-in period, and thinning factor.
The algorithm first computes initial parameter estimates under Hybrid Type-II censoring, evaluates baseline GPCI point estimates, runs Metropolis-Hastings within Gibbs sampler MCMC, computes the thinned GPCI chain, and returns comprehensive posterior point estimates, bias, MSE, Bayes risk, HPD credible intervals at 90%, 95%, and 99% levels, Heidelberger and Welch's MCMC convergence diagnostics, and coverage probabilities.
Missing values (NA, NaN) in input vectors or invalid parameter evaluations
are safely trapped and imputed using robust baseline statistics. Logical inputs are handled as
standard boolean values (TRUE or FALSE).
An object of class "gpci_mcmc" containing:
hybrid2_mle |
Named numeric vector of initial maximum likelihood estimates under Hybrid Type-II censoring. |
uncensored_mle |
Alias for |
initial_gpcis |
Named numeric vector of GPCI point estimates evaluated at initial MLEs. |
param_chain |
Numeric matrix of thinned post-burn-in parameter MCMC samples. |
gpci_chain |
Numeric matrix of thinned post-burn-in GPCI MCMC samples. |
param_summary |
Data frame containing parameter posterior statistics (Estimate, Bias, MSE, Bayes Risk, 90%, 95%, 99% HPD limits, Heidelberger-Welch test, Convergence Probability, Coverage Probability). |
gpci_summary |
Data frame containing GPCI posterior statistics (Estimate, Bias, MSE, Bayes Risk, 90%, 95%, 99% HPD limits, Heidelberger-Welch test, Convergence Probability, Coverage Probability). |
accept_rates |
Named numeric vector of acceptance rates for parameter updates. |
data |
List containing validated Hybrid Type-II censoring data components. |
distribution |
Target distribution object used for estimation. |
USL, LSL, target
|
Process specification parameters. |
indices |
Character vector of evaluated indices. |
# Example using custom user-supplied functions for Exponential lifetime data my_pdf <- function(x, rate) dexp(x, rate = rate) my_cdf <- function(q, rate) pexp(q, rate = rate) my_surv <- function(q, rate) pexp(q, rate = rate, lower.tail = FALSE) x_data <- c(0.5, 1.2, 2.1, 3.4) fit <- gpci_hybrid2_mcmc( x = x_data, r = 3, tc = 2.5, n = 10, pdf = my_pdf, cdf = my_cdf, surv = my_surv, param_names = "rate", start = c(rate = 0.5), length_chain = 1000, burn_in = 200, thinning = 2, USL = 8, LSL = 0, target = 4 ) print(fit)# Example using custom user-supplied functions for Exponential lifetime data my_pdf <- function(x, rate) dexp(x, rate = rate) my_cdf <- function(q, rate) pexp(q, rate = rate) my_surv <- function(q, rate) pexp(q, rate = rate, lower.tail = FALSE) x_data <- c(0.5, 1.2, 2.1, 3.4) fit <- gpci_hybrid2_mcmc( x = x_data, r = 3, tc = 2.5, n = 10, pdf = my_pdf, cdf = my_cdf, surv = my_surv, param_names = "rate", start = c(rate = 0.5), length_chain = 1000, burn_in = 200, thinning = 2, USL = 8, LSL = 0, target = 4 ) print(fit)
Conducts the stationarity test and relative half-width test under Heidelberger and Welch's MCMC convergence diagnostic.
heidelberger_welch(x, alpha = 0.05, eps = 0.1)heidelberger_welch(x, alpha = 0.05, eps = 0.1)
x |
Numeric vector representing an MCMC sample chain. |
alpha |
Significance level for the test (default is 0.05). |
eps |
Target maximum ratio of half-width to sample mean (default is 0.1). |
A list containing:
stat |
Cramér-von Mises stationarity test statistic. |
pvalue |
Estimated p-value for the stationarity test. |
passed |
Logical scalar: |
hw_stat |
Half-width test ratio. |
hw_passed |
Logical scalar: |
convergence_prob |
Estimated convergence probability. |
samples <- stats::rnorm(1000) heidelberger_welch(samples)samples <- stats::rnorm(1000) heidelberger_welch(samples)
Computes the Highest Posterior Density (HPD) interval for MCMC posterior samples at specified confidence / credibility levels (e.g. 90%, 95%, 99%).
hpd_interval(x, prob = 0.95)hpd_interval(x, prob = 0.95)
x |
Numeric vector of MCMC posterior samples. Missing and non-finite values are automatically removed. |
prob |
Credibility level ( |
A named numeric vector of length 2 containing lower and upper HPD limits.
samples <- stats::rnorm(1000, mean = 5, sd = 1) hpd_interval(samples, prob = 0.95)samples <- stats::rnorm(1000, mean = 5, sd = 1) hpd_interval(samples, prob = 0.95)
Fits initial parameter estimates and generates MCMC posterior chains using Metropolis-Hastings within Gibbs sampler for Hybrid Type-II censored lifetime data.
mcmc_hybrid_ty2( x, r, tc, n, distribution, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, proposal_sd = NULL )mcmc_hybrid_ty2( x, r, tc, n, distribution, start = NULL, priors = NULL, length_chain = 10000, burn_in = 2000, thinning = 5, proposal_sd = NULL )
x |
Numeric vector of observed failure times. Missing and non-finite values are not permitted. |
r |
Positive integer scalar specifying the target number of failures ( |
tc |
Positive numeric scalar specifying the fixed censoring time ( |
n |
Positive integer scalar specifying total initial sample size placed on test ( |
distribution |
A |
start |
Named numeric vector or list of initial parameter values. If |
priors |
List of prior specifications or a custom log-prior function. If |
length_chain |
Positive integer scalar specifying total MCMC iterations. Default is 10000. |
burn_in |
Positive integer scalar specifying burn-in iterations to discard. Default is 2000. |
thinning |
Positive integer scalar specifying thinning factor. Default is 5. |
proposal_sd |
Optional numeric vector or list of proposal standard deviations for M-H updates. |
Under Hybrid Type-II censoring, a total of items are placed on test. The test terminates at
time , where is the pre-fixed target number of failures and is the pre-fixed
censoring time. The likelihood function is:
where is the number of observed failures up to time .
A list containing:
hybrid2_mle |
Named numeric vector of initial maximum likelihood estimates under Hybrid Type-II censoring. |
uncensored_mle |
Alias for |
param_chain |
Numeric matrix of thinned post-burn-in parameter MCMC samples. |
raw_chain |
Numeric matrix of all generated MCMC samples. |
accept_rates |
Named numeric vector of acceptance rates for each parameter. |
data |
Validated Hybrid Type-II censoring data summary list. |
distribution |
Target distribution object. |
dist_exp <- dist_exponential(rate = 1) x_obs <- c(0.4, 0.9, 1.5, 2.3) res <- mcmc_hybrid_ty2(x = x_obs, r = 3, tc = 2.0, n = 10, distribution = dist_exp, length_chain = 500, burn_in = 100, thinning = 2)dist_exp <- dist_exponential(rate = 1) x_obs <- c(0.4, 0.9, 1.5, 2.3) res <- mcmc_hybrid_ty2(x = x_obs, r = 3, tc = 2.0, n = 10, distribution = dist_exp, length_chain = 500, burn_in = 100, thinning = 2)
Generates MCMC trace plots and posterior density histograms with Highest Posterior Density (HPD) intervals.
## S3 method for class 'gpci_mcmc' plot(x, index = NULL, ...)## S3 method for class 'gpci_mcmc' plot(x, index = NULL, ...)
x |
An object of class |
index |
Character string specifying the capability index to plot (e.g. |
... |
Additional graphical arguments. |
Invisibly returns the input object x.
Print Method for gpci_dist_hybrid2mcmc Objects
## S3 method for class 'gpci_dist_hybrid2mcmc' print(x, ...)## S3 method for class 'gpci_dist_hybrid2mcmc' print(x, ...)
x |
An object of class |
... |
Additional arguments. |
The invisible object x.
Print Method for gpci_gof_hybrid2 Objects
## S3 method for class 'gpci_gof_hybrid2' print(x, ...)## S3 method for class 'gpci_gof_hybrid2' print(x, ...)
x |
An object of class |
... |
Additional arguments. |
The invisible object x.
Prints a structured summary of initial point estimates and MCMC posterior capability analysis results.
## S3 method for class 'gpci_mcmc' print(x, ...)## S3 method for class 'gpci_mcmc' print(x, ...)
x |
An object of class |
... |
Additional print arguments. |
Invisibly returns the input object x.
Print Method for summary.gpci_mcmc Objects
## S3 method for class 'summary.gpci_mcmc' print(x, ...)## S3 method for class 'summary.gpci_mcmc' print(x, ...)
x |
An object of class |
... |
Additional print arguments. |
Invisibly returns the input object x.
Computes posterior mean point estimate, bias, mean squared error (MSE), Bayes risk, Highest Posterior Density (HPD) intervals at 90%, 95%, and 99% levels, Heidelberger-Welch convergence diagnostics, and empirical coverage probabilities.
summarize_chain(chain, true_val = NULL)summarize_chain(chain, true_val = NULL)
chain |
Numeric vector, matrix, or data frame of MCMC posterior draws. |
true_val |
Optional numeric scalar or named vector representing the true value or baseline estimate for bias and MSE evaluation. |
A data frame containing:
Variable |
Name of the parameter or capability index. |
Estimate |
Posterior mean estimate. |
Bias |
Posterior bias ( |
MSE |
Posterior mean squared error. |
Bayes_Risk |
Bayes risk under squared error loss (posterior variance). |
HPD_90_Lower, HPD_90_Upper
|
Lower and upper bounds of 90% HPD interval. |
HPD_95_Lower, HPD_95_Upper
|
Lower and upper bounds of 95% HPD interval. |
HPD_99_Lower, HPD_99_Upper
|
Lower and upper bounds of 99% HPD interval. |
HW_Stat |
Heidelberger-Welch stationarity test statistic. |
HW_PValue |
p-value for Heidelberger-Welch test. |
HW_Passed |
Logical status of Heidelberger-Welch stationarity test. |
Convergence_Prob |
Estimated convergence probability. |
Coverage_Prob |
Empirical coverage probability (1 if true value is within 95% HPD interval). |
samples <- stats::rnorm(1000, mean = 1.5, sd = 0.2) summarize_chain(samples, true_val = 1.5)samples <- stats::rnorm(1000, mean = 1.5, sd = 0.2) summarize_chain(samples, true_val = 1.5)
Summary Method for gpci_dist_hybrid2mcmc Objects
## S3 method for class 'gpci_dist_hybrid2mcmc' summary(object, ...)## S3 method for class 'gpci_dist_hybrid2mcmc' summary(object, ...)
object |
An object of class |
... |
Additional arguments. |
The invisible object object.
Summary Method for gpci_gof_hybrid2 Objects
## S3 method for class 'gpci_gof_hybrid2' summary(object, ...)## S3 method for class 'gpci_gof_hybrid2' summary(object, ...)
object |
An object of class |
... |
Additional arguments. |
The invisible object object.
Provides complete posterior statistical summary including HPD intervals and Heidelberger-Welch diagnostics.
## S3 method for class 'gpci_mcmc' summary(object, ...)## S3 method for class 'gpci_mcmc' summary(object, ...)
object |
An object of class |
... |
Additional summary arguments. |
An S3 object of class "summary.gpci_mcmc" containing parameter and GPCI summary tables.
Internal helper to validate inputs for Hybrid Type-II censored lifetime data.
validate_hybrid2_data(x, r, tc, n)validate_hybrid2_data(x, r, tc, n)
x |
Numeric vector of observed failure times. Missing values ( |
r |
Positive integer scalar specifying the target number of failures. |
tc |
Positive numeric scalar specifying the fixed censoring time. |
n |
Positive integer scalar specifying the total initial sample size placed on test. Must be greater than or equal to |
A validated list containing:
x |
Numeric vector of sorted observed failure times. |
r |
Target number of failures (integer). |
tc |
Fixed censoring time (numeric). |
n |
Total sample size on test (integer). |
d |
Number of observed failures (integer). |
t_star |
Effective test termination time |
validate_hybrid2_data(x = c(0.5, 1.2, 2.1, 3.4), r = 3, tc = 2.5, n = 10)validate_hybrid2_data(x = c(0.5, 1.2, 2.1, 3.4), r = 3, tc = 2.5, n = 10)