## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## ----example------------------------------------------------------------------
library(gpcihybridIImcmc)

# User-defined Exponential lifetime distribution functions
my_pdf  <- function(x, rate) stats::dexp(x, rate = rate)
my_cdf  <- function(q, rate) stats::pexp(q, rate = rate)
my_surv <- function(q, rate) stats::pexp(q, rate = rate, lower.tail = FALSE)

# Hybrid Type-II censored sample: n = 10 units, target r = 3, censoring time tc = 2.5
data <- c(0.5, 1.2, 2.1, 3.4)

fit <- gpci_hybrid2_mcmc(
  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)

