\name{r_impadapt2_censor}
\alias{r_impadapt2_censor}
\title{Data Generation under Improved Adaptive Type-II Progressive Censoring Scheme}
\usage{
r_impadapt2_censor(
  n,
  m,
  T1,
  T2 = NULL,
  R,
  pdf = NULL,
  cdf = NULL,
  qdf = NULL,
  par = NULL,
  seed = NULL,
  lower = 1e-07,
  upper = 100000
)
}
\arguments{
\item{n}{Integer, total number of units placed on test (n >= 1).}

\item{m}{Integer, pre-fixed target number of failures (1 <= m <= n).}

\item{T1}{Numeric, first pre-fixed threshold time point (T1 > 0).}

\item{T2}{Numeric or NULL, second pre-fixed threshold time point (T2 > T1). If NULL, defaults to Inf.}

\item{R}{Numeric vector of length m, pre-fixed progressive censoring scheme satisfying sum(R) + m = n.}

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

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

\item{qdf}{Function (optional), user-supplied quantile function qdf(p, par).}

\item{par}{Numeric vector, true parameter values for the specified distribution.}

\item{seed}{Optional integer, seed for random number generation.}

\item{lower}{Numeric, lower bound for numerical quantile root finding (default 1e-7).}

\item{upper}{Numeric, upper bound for numerical quantile root finding (default 1e5).}
}
\value{
An object of class \code{"impadapt2_sample"} containing:
\item{data}{Numeric vector of observed failure times up to test termination.}
\item{case}{Character string indicating the realized censoring case ("Case I", "Case II", or "Case III").}
\item{d1}{Number of failures observed at or before threshold time T1.}
\item{d2}{Number of failures observed at or before threshold time T2.}
\item{D1}{Value of D1 parameter for likelihood construction.}
\item{D2}{Value of D2 parameter (total observed failures) for likelihood construction.}
\item{R_effective}{Numeric vector of effective progressive censoring plan applied.}
\item{R_star}{Number of remaining live units removed at experiment termination time T_star.}
\item{T_star}{Terminal time of the experiment (X_m for Cases I and II; T2 for Case III).}
\item{T1}{Threshold time T1.}
\item{T2}{Threshold time T2.}
\item{n}{Total sample size.}
\item{m}{Target failure count.}
\item{R_initial}{Initial pre-fixed progressive censoring plan.}
\item{par}{True parameter values.}
}
\description{
Generates random censored lifetime data under the Improved Adaptive Type-II Progressive Censoring Scheme (IAT-II PCS)
as described by Dev and Chacko (2026) and Yan et al. (2021).
}
\examples{
set.seed(123)
ge_cdf <- function(x, par) (1 - exp(-par[2] * x))^par[1]
ge_pdf <- function(x, par) par[1] * par[2] * exp(-par[2] * x) * (1 - exp(-par[2] * x))^(par[1] - 1)
ge_qdf <- function(p, par) - (1 / par[2]) * log(1 - p^(1 / par[1]))

res <- r_impadapt2_censor(
  n = 20, m = 10, T1 = 0.8, T2 = 2.0,
  R = c(rep(1, 10)),
  pdf = ge_pdf, cdf = ge_cdf, qdf = ge_qdf,
  par = c(1.5, 0.8)
)
print(res)
}
\references{
Dev, S. S., & Chacko, M. (2026). Statistical inference for generalized exponential distribution under improved adaptive Type-II progressive censoring.
\emph{Journal of the Iranian Statistical Society}, 25(2), 1-29. DOI: 10.22034/jirss.2026.2077492.1165.

Yan, L., Zhang, Q., & Dong, A. (2021). Inference for the Burr XII distribution based on improved adaptive progressive Type-II censoring.
\emph{Journal of Computational and Applied Mathematics}, 381, 113022. DOI: 10.1016/j.cam.2020.113022.

Balakrishnan, N., & Sandhu, R. (1995). A simple simulational algorithm for generating progressively Type-II censored samples.
\emph{The American Statistician}, 49(2), 229-230.
}
