rcens | R Documentation |
This function generates censored samples from a specified distribution, using Type I (time-based) or Type II (failure-based) censoring schemes.
rcens(n, r = NULL, dist, type = c("I", "II"), cens.time = NULL, ...)
n |
total number of items in the sample |
r |
number of uncensored observations (only for Type II censoring). |
dist |
a character string specifying the name of the distribution
(e.g., |
type |
type of censoring: |
cens.time |
censoring time for Type I censoring. |
... |
further arguments to be passed to |
This function implements two types of censoring schemes:
Type I censoring: Observations are censored if they exceed a specified cens.time
.
The function returns all observations less than cens.time
.
Type II censoring: The smallest r
observations are returned, simulating
a situation where the experiment stops after r
failures.
A numeric vector of censored samples.
rpcens2
# Type I censoring: Exponential distribution with rate = 1, censored at time 2
rcens(n = 10, dist = "exp", type = "I", cens.time = 2, rate = 1)
# Type II censoring: Normal distribution, smallest 5 values
rcens(n = 10, r = 5, dist = "norm", type = "II", mean = 0, sd = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.