% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/bayes_mcmc.R
\name{bayes_adapt2_phcs}
\alias{bayes_adapt2_phcs}
\title{Bayesian Estimation via Metropolis-Hastings MCMC under Adaptive Type-II PHCS}
\usage{
bayes_adapt2_phcs(
  data,
  n,
  m,
  T_thresh,
  R,
  pdf,
  cdf = NULL,
  surf = NULL,
  prior = NULL,
  start,
  N_iter = 5000,
  burn_in = 1000,
  proposal_sd = NULL,
  lower = NULL,
  upper = NULL
)
}
\arguments{
\item{data}{Numeric vector of m observed failure times.}

\item{n}{Integer, total initial sample size placed on test.}

\item{m}{Integer, pre-fixed target number of failures.}

\item{T_thresh}{Numeric, pre-fixed time threshold T > 0.}

\item{R}{Numeric vector of length m, progressive censoring scheme.}

\item{pdf}{Function, user-supplied probability density function pdf(x, par).}

\item{cdf}{Function (optional), user-supplied cumulative distribution function cdf(x, par).}

\item{surf}{Function (optional), user-supplied survival function surf(x, par).}

\item{prior}{Function, user-supplied prior density function log_prior(par). Default is flat prior.}

\item{start}{Numeric vector, initial parameter values.}

\item{N_iter}{Integer, total number of MCMC iterations (default 5000).}

\item{burn_in}{Integer, burn-in iterations to discard (default 1000).}

\item{proposal_sd}{Numeric vector, standard deviations for random-walk proposal.}

\item{lower}{Numeric vector (optional), lower parameter constraints.}

\item{upper}{Numeric vector (optional), upper parameter constraints.}
}
\value{
A list containing posterior means, medians, modes, standard deviations, HPD credible intervals, and parameter chain samples.
}
\description{
Performs Bayesian parameter estimation under Adaptive Type-II Progressive Hybrid Censoring
using Metropolis-Hastings / Gibbs MCMC sampling.
}
\examples{
set.seed(123)
my_cdf <- function(x, par) pexp(x, rate = par[1])
my_pdf <- function(x, par) dexp(x, rate = par[1])
my_surf <- function(x, par) 1 - pexp(x, rate = par[1])
flat_prior <- function(par) ifelse(par[1] > 0, 0, -Inf)
R_plan <- c(rep(1, 8), rep(0, 4))
dat <- r_adapt2_phcs(
  n = 20, m = 12, T_thresh = 2.5,
  R = R_plan, pdf = my_pdf,
  cdf = my_cdf, par = 0.5
)$data
bayes_res <- bayes_adapt2_phcs(
  data = dat, n = 20, m = 12,
  T_thresh = 2.5, R = R_plan,
  pdf = my_pdf, cdf = my_cdf,
  surf = my_surf, prior = flat_prior,
  start = c(rate = 0.8), N_iter = 1000,
  burn_in = 200
)
print(bayes_res$summary)
}
