## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----example1-----------------------------------------------------------------
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)

## ----example2-----------------------------------------------------------------
# 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)

## ----example3-----------------------------------------------------------------
diag_res <- compute_diagnostics_hybrid2(
  fit = fit,
  true_params = c(rate = 1),
  B = 30
)
print(diag_res)

## ----example4-----------------------------------------------------------------
gof_res <- gof_test_hybrid2(
  fit = fit,
  p.method = "montecarlo",
  nsim = 30
)
print(gof_res)

