# Generalized Process Capability Indices under Hybrid Type-II Censoring

## Introduction

The `gpcihybridII` package provides a comprehensive, generalized framework for estimating, computing, and validating Generalized Process Capability Indices (GPCIs) under Hybrid Type-II censored lifetime data.

Under Hybrid Type-II censoring (Childs et al., 2003; Balakrishnan & Kundu, 2013), \(n\) identical units are placed on life test with a pre-fixed target number of failures \(r \in \{1, \dots, n\}\) and a pre-fixed censoring time \(T_0\) (\(t_c\)). The experiment terminates at \(T^* = \max(X_{r:n}, T_0)\).

The package: 1. Fits distribution parameters under Hybrid Type-II censored data using Maximum Likelihood Estimation via the `MleCensoR` package (`mle_hybrid_type2`). 2. Evaluates classical capability indices (\(C_p, C_{pk}, C_{pm}, C_{pmk}, C_p(u, v)\)) and generalized capability indices from literature (\(C_{py}, S_{pmk}, C_{pTk}, C_{pc}, CN_{pmc}, CN_{pmkc}, CN_{pk}\)). 3. Calculates parametric and non-parametric bootstrap confidence intervals (Percentile, Normal, Basic, BCp, BCa, Studentized) at 90 percent, 95 percent, and 99 percent confidence levels. 4. Computes performance metrics (Standard Errors, Bias, MSE) and Coverage Probabilities for model parameters and capability indices. 5. Integrates goodness-of-fit testing for Hybrid Type-II censored data via the `gofPHCS` package.

## Example 1: Analysis with Exponential Distribution

    library(gpcihybridII)

    # 1. Define Exponential distribution
    dist_exp <- dist_exponential(rate = 1)

    # 2. Observed failure times under Hybrid Type-II censoring
    # Total units n = 10, target failures r = 3, censoring time tc = 1.0
    x_data <- c(0.18, 0.42, 0.75, 0.95)

    # 3. Process Capability Analysis
    fit <- capability_hybrid2(
      x = x_data, r = 3, tc = 1.0, n = 10,
      distribution = dist_exp,
      USL = 3.0, LSL = 0.0, target = 1.5,
      indices = c("Cpy", "Spmk", "CpTk", "Cpc", "CNpmc", "CNpmkc", "Cp", "Cpk", "Cpm", "Cpmk"),
      mode = "moments"
    )
    print(fit)
    #> --- Process Capability Analysis (Hybrid Type-II Censored Data) ---
    #> Distribution:  Exponential
    #> Parameters:    rate = 0.4819
    #> Hybrid Scheme: n = 10 , r = 3 , tc = 1 , failures = 4
    #> Spec Limits:  LSL = 0 , USL = 3 , Target = 1.5
    #> Mode:          moments
    #> Expected Nonconforming (p_hat):  23.5561 %
    #>
    #> Point Estimates of Capability Indices:
    #>    Cpy   Spmk   CpTk    Cpc  CNpmc CNpmkc     Cp    Cpk    Cpm   Cpmk
    #> 0.7665 0.3810 0.9446 0.0115 0.2004 0.2004 0.2420 0.1496 0.2332 0.1441

## Example 2: Bootstrap Confidence Intervals

    # Compute Bootstrap CIs at 90%, 95%, and 99% confidence levels
    ci_res <- boot_ci_hybrid2(
      fit = fit,
      B = 50,
      alpha = c(0.10, 0.05, 0.01),
      method = "percentile",
      type = "parametric"
    )
    print(ci_res)
    #> --- Hybrid Type-II Bootstrap Confidence Intervals ---
    #> Bootstrap Type:    parametric
    #> CI Method:         percentile
    #> Replicates (B):    50
    #>
    #> Performance Summary (Standard Error, Bias, MSE):
    #> Parameters:
    #>      item estimate     se   bias    mse
    #> rate rate   0.4819 0.2086 0.0346 0.0438
    #>
    #> Capability Indices:
    #>          item estimate     se    bias    mse
    #> Cpy       Cpy   0.7665 0.1319 -0.0146 0.0173
    #> Spmk     Spmk   0.3810 0.1203  0.0038 0.0142
    #> CpTk     CpTk   0.9446 0.1557 -0.2201 0.0722
    #> Cpc       Cpc   0.0115 0.0140  0.0045 0.0002
    #> CNpmc   CNpmc   0.2004 0.0587 -0.0015 0.0034
    #> CNpmkc CNpmkc   0.2004 0.0587 -0.0015 0.0034
    #> Cp         Cp   0.2420 0.1047  0.0174 0.0111
    #> Cpk       Cpk   0.1496 0.1526  0.0026 0.0228
    #> Cpm       Cpm   0.2332 0.1017  0.0131 0.0103
    #> Cpmk     Cpmk   0.1441 0.1465  0.0054 0.0211
    #>
    #> Confidence Intervals (90%, 95%, 99%):
    #>         type  index estimate     method bootstrap_type alpha conf_level   lower
    #> 1       GPCI    Cpy   0.7665 percentile     parametric  0.10        90%  0.5089
    #> 2       GPCI    Cpy   0.7665 percentile     parametric  0.05        95%  0.4875
    #> 3       GPCI    Cpy   0.7665 percentile     parametric  0.01        99%  0.4710
    #> 4       GPCI   Spmk   0.3810 percentile     parametric  0.10        90%  0.1922
    #> 5       GPCI   Spmk   0.3810 percentile     parametric  0.05        95%  0.1809
    #> 6       GPCI   Spmk   0.3810 percentile     parametric  0.01        99%  0.1727
    #> 7       GPCI   CpTk   0.9446 percentile     parametric  0.10        90%  0.4402
    #> 8       GPCI   CpTk   0.9446 percentile     parametric  0.05        95%  0.4088
    #> 9       GPCI   CpTk   0.9446 percentile     parametric  0.01        99%  0.3325
    #> 10      GPCI    Cpc   0.0115 percentile     parametric  0.10        90%  0.0055
    #> 11      GPCI    Cpc   0.0115 percentile     parametric  0.05        95%  0.0053
    #> 12      GPCI    Cpc   0.0115 percentile     parametric  0.01        99%  0.0051
    #> 13      GPCI  CNpmc   0.2004 percentile     parametric  0.10        90%  0.1005
    #> 14      GPCI  CNpmc   0.2004 percentile     parametric  0.05        95%  0.0941
    #> 15      GPCI  CNpmc   0.2004 percentile     parametric  0.01        99%  0.0894
    #> 16      GPCI CNpmkc   0.2004 percentile     parametric  0.10        90%  0.1005
    #> 17      GPCI CNpmkc   0.2004 percentile     parametric  0.05        95%  0.0941
    #> 18      GPCI CNpmkc   0.2004 percentile     parametric  0.01        99%  0.0894
    #> 19      GPCI     Cp   0.2420 percentile     parametric  0.10        90%  0.1187
    #> 20      GPCI     Cp   0.2420 percentile     parametric  0.05        95%  0.1115
    #> 21      GPCI     Cp   0.2420 percentile     parametric  0.01        99%  0.1062
    #> 22      GPCI    Cpk   0.1496 percentile     parametric  0.10        90% -0.0970
    #> 23      GPCI    Cpk   0.1496 percentile     parametric  0.05        95% -0.1115
    #> 24      GPCI    Cpk   0.1496 percentile     parametric  0.01        99% -0.1220
    #> 25      GPCI    Cpm   0.2332 percentile     parametric  0.10        90%  0.0997
    #> 26      GPCI    Cpm   0.2332 percentile     parametric  0.05        95%  0.0926
    #> 27      GPCI    Cpm   0.2332 percentile     parametric  0.01        99%  0.0877
    #> 28      GPCI   Cpmk   0.1441 percentile     parametric  0.10        90% -0.0814
    #> 29      GPCI   Cpmk   0.1441 percentile     parametric  0.05        95% -0.0927
    #> 30      GPCI   Cpmk   0.1441 percentile     parametric  0.01        99% -0.1006
    #> 31 Parameter   rate   0.4819 percentile     parametric  0.10        90%  0.2364
    #> 32 Parameter   rate   0.4819 percentile     parametric  0.05        95%  0.2219
    #> 33 Parameter   rate   0.4819 percentile     parametric  0.01        99%  0.2115
    #>     upper  width
    #> 1  0.9362 0.4273
    #> 2  0.9460 0.4585
    #> 3  0.9656 0.4946
    #> 4  0.5731 0.3808
    #> 5  0.5803 0.3994
    #> 6  0.5819 0.4092
    #> 7  0.9574 0.5172
    #> 8  0.9798 0.5710
    #> 9  0.9933 0.6608
    #> 10 0.0414 0.0359
    #> 11 0.0477 0.0425
    #> 12 0.0780 0.0729
    #> 13 0.2876 0.1871
    #> 14 0.2924 0.1983
    #> 15 0.3008 0.2113
    #> 16 0.2876 0.1871
    #> 17 0.2924 0.1983
    #> 18 0.3008 0.2113
    #> 19 0.4557 0.3370
    #> 20 0.4808 0.3693
    #> 21 0.5581 0.4519
    #> 22 0.3344 0.4315
    #> 23 0.3344 0.4460
    #> 24 0.3344 0.4564
    #> 25 0.4272 0.3275
    #> 26 0.4402 0.3476
    #> 27 0.4608 0.3732
    #> 28 0.3331 0.4145
    #> 29 0.3336 0.4263
    #> 30 0.3343 0.4349
    #> 31 0.9073 0.6710
    #> 32 0.9574 0.7355
    #> 33 1.1113 0.8998

## Example 3: Diagnostics and Performance Evaluation

    diag_res <- compute_diagnostics_hybrid2(
      fit = fit,
      true_params = c(rate = 1),
      B = 30
    )
    print(diag_res)
    #> --- Performance Diagnostics (Hybrid Type-II Censored Data) ---
    #> Bootstrap Replicates (B): 30
    #>
    #> Model Parameters Summary:
    #>      Estimate   SE   Bias    MSE
    #> rate   0.4819 0.21 0.0386 0.2684
    #>
    #> Parameter Empirical Coverage:
    #>      X90. X95. X99.
    #> rate    0    0    1
    #>
    #> Process Capability Indices Summary:
    #>        Estimate     SE    Bias    MSE
    #> Cpy      0.7665 0.1092 -0.0067 0.0116
    #> Spmk     0.3810 0.1055  0.0049 0.0108
    #> CpTk     0.9446 0.1496 -0.1924 0.0586
    #> Cpc      0.0115 0.0222  0.0057 0.0005
    #> CNpmc    0.2004 0.0514  0.0002 0.0026
    #> CNpmkc   0.2004 0.0514  0.0002 0.0026
    #> Cp       0.2420 0.1055  0.0194 0.0111
    #> Cpk      0.1496 0.1384  0.0067 0.0186
    #> Cpm      0.2332 0.0929  0.0129 0.0085
    #> Cpmk     0.1441 0.1349  0.0071 0.0176

## Example 4: Goodness-of-Fit Testing

    gof_res <- gof_test_hybrid2(
      fit = fit,
      p.method = "montecarlo",
      nsim = 30
    )
    print(gof_res)
    #> --- Goodness-of-Fit Test (Hybrid Type-II Censored Data) ---
    #> Distribution:  Exponential
    #> Test Method:   Monte Carlo Test (30 replicates) (KSII for hybridII scheme)
    #> Statistic:     KSII = 0.3268
    #> p-value:       1

## References

- Alotaibi, N., Dey, S., & Saha, M. (2022). Estimation and Confidence Intervals of a New PCI \(CN_{pmc}\) for Logistic-Exponential Distribution. Journal of Mathematics, 2022, 3135264. https://doi.org/10.1155/2022/3135264
- Balakrishnan, N., & Kundu, D. (2013). Hybrid censoring: models, methods and applications. Naval Research Logistics, 60(5), 359-385. https://doi.org/10.1002/nav.21545
- Childs, A., Chandrasekar, B., Balakrishnan, N., & Kundu, D. (2003). Exact likelihood inference for Type-I and Type-II hybrid censored data from the exponential distribution. Annals of the Institute of Statistical Mathematics, 55(2), 319-330. https://doi.org/10.1007/BF02517803
- Dey, S., & Saha, M. (2019). Assessing the process capability index \(S_{pmk}\) for Gompertz distribution. Quality and Reliability Engineering International, 35(8), 2639-2661. https://doi.org/10.1007/s41872-019-00081-4
- Maiti, S. S., Saha, M., & Nanda, A. K. (2010). On generalizing process capability indices. International Journal of Quality & Reliability Management, 27(6), 704-715. https://doi.org/10.1080/16843703.2010.11673233
- Saha, M., Dey, S., & Maiti, S. S. (2018). Classical and Bayesian inference of \(C_{py}\) for Lindley distribution. Quality Technology & Quantitative Management, 15(6), 724-746. https://doi.org/10.1080/21681015.2018.1437793
- Saha, M., Dey, S., & Nadarajah, S. (2022). On generalizing process capability index \(C_{pc}\). Journal of Applied Statistics, 49(14), 3624-3642. https://doi.org/10.1080/02664763.2021.1971632
- Saha, M., Tripathi, V., & Dey, S. (2024). A new generalized process capability index \(CN_{pmkc}\) under non-normal processes. Communications in Statistics - Simulation and Computation. https://doi.org/10.1142/S021853932450013X