## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----setup--------------------------------------------------------------------
library(gpcihybridIILinApp)

## ----example-custom-----------------------------------------------------------
set.seed(42)
x_obs <- c(0.2, 0.5, 0.8, 1.1, 1.4)

fit_res <- gpci_lindley_hybrid2(
  x = x_obs, r = 3, tc = 1.2, n = 10,
  pdf = function(x, rate = 1) stats::dexp(x, rate = rate),
  cdf = function(x, rate = 1) stats::pexp(x, rate = rate),
  sf  = function(x, rate = 1) stats::pexp(x, rate = rate, lower.tail = FALSE),
  chain_length = 50,
  burn_in = 10,
  thinning = 1,
  USL = 3,
  LSL = 0,
  target = 1.5,
  indices = c("Cpy", "Cp", "Cpk", "Cpm", "CNpmc"),
  B = 20
)

# Display Summary Diagnostics Table
summary(fit_res)

## ----example-builtin----------------------------------------------------------
dist_exp <- dist_exponential(rate = 1)

fit_exp <- lindley_gpci_hybrid2(
  x = x_obs, r = 3, tc = 1.2, n = 10,
  distribution = dist_exp,
  chain_length = 50,
  burn_in = 10,
  thinning = 1,
  USL = 3,
  LSL = 0,
  target = 1.5,
  indices = c("Cpy", "Cp", "Cpk", "Cpm", "CNpmc"),
  B = 20
)

summary(fit_exp)

## ----example-gof--------------------------------------------------------------
gof_res <- gof_test_hybrid2(
  fit = fit_exp,
  p.method = "asymptotic"
)

print(gof_res)

