rcensT2 {rcens}R Documentation

Generate Censoring Sample, Type II

Description

Generator of censored samples type II with right or left censoring, given a generator of samples of the distribution X (rdistrX) with parameters appended by the list param_X. In which, you can control the number of censored sample or the desired censorship percentage.

Usage

rcensT2(
  rdistrX,
  param_X,
  n = 10000,
  m_censored = -1,
  theta = 0.5,
  verbose = FALSE,
  right = TRUE
)

Arguments

rdistrX

sample generator of distribution X. \ First argument number of samples, next arguments in param_X.

param_X

list with parameters of rdistrX function.

n

number of sample to create.

m_censored

number of sample censored. m_censored < n. \ If m_censored <= n, m_censored is estimate with the desired censoring percentage.

theta

Desired censoring percentage.

verbose

if TRUE print a censoring percentage of new created database.

right

if TRUE create right-censored data, else create left-censored

Value

A list with sample data information:

sample_censored vector of censored sample
sample_uncensored vector of uncensored sample (original)
censored_indicator vector of 1 and 0 indicating whether the i-th sample is censored
1:= no censored, 0:= censored
censored_time vector of censorship time
n_censored number of censored samples

Author(s)

Daniel Saavedra Morales

See Also

rcensT1 for generate censorship sample type I.
rcensT3 for generate censorship sample type III
rcensI for generate interval censoring sample with random length interval
rcensIfix for generate interval censoring sample with fix length interval

Examples

##Example Exponential

## Number of sample censored
Data_T2 = rcensT2(rdistrX = rexp, param_X = list("rate" = 2), n = 1e02, m_censored = 9)

## Number of censored sample estimate with desired censoring percentage.
Data_T2 = rcensT2(rdistrX = rexp, param_X = list("rate" = 2), n = 1e02, theta = .8)


## Example with plot in examples_plot/Example_rcensT2_plot.R

[Package rcens version 0.1.1 Index]