% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/censor_schemes.R
\name{r_type2_censor}
\alias{r_type2_censor}
\title{Type-II (failure-terminated) censoring}
\usage{
r_type2_censor(n, dist, r_failures = NULL, seed = NULL)
}
\arguments{
\item{n}{sample size.}

\item{dist}{a \code{\link{dist_spec}} object.}

\item{r_failures}{number of failures before termination (default
\eqn{\lfloor 0.7n \rfloor}).}

\item{seed}{optional integer seed.}
}
\value{
A \code{censored_sample} object (S3 class) containing:
\code{scheme} (character), \code{dist} (the \code{dist_spec}),
\code{n} (integer sample size), \code{seed}, \code{t_true} (numeric
vector of latent failure times), \code{x} (observed/censored values),
\code{status} (integer: 0 = right-censored, 1 = event, 2 = left-censored,
3 = interval-censored, 4 = middle-censored), and \code{time2}
(upper interval bound where applicable, \code{NA} otherwise).
}
\description{
Experiment stops at the \code{r_failures}-th observed failure; remaining
units are right-censored at that time.
}
\examples{
d <- dist_spec(q = function(u, p) -log(1 - u) / p$rate,
               param = list(rate = 1), name = "Exp(1)")
r_type2_censor(30, d, r_failures = 20, seed = 1)
}
