Title: | Generate Sample Censoring |
---|---|
Description: | Provides functions to generate censored samples of type I, II and III, from any random sample generator. It also supplies the option to create left and right censorship. Along with this, the generation of samples with interval censoring is in the testing phase, with two options of fixed length intervals and random lengths. |
Authors: | Daniel Saavedra [aut, cre, cph]
|
Maintainer: | Daniel Saavedra <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.1.1 |
Built: | 2025-02-12 03:54:51 UTC |
Source: | https://github.com/dlsaavedra/rcens |
Generator of interval censored samples where the length of interval is random, given a generator of samples of the distribution X (rdistrX) with parameters appended by the list param_X. Generator sample of distribution C (censoring) with parameters appended by the list param_C In which, you can control the desired censorship percentage.
rcensI( rdistrX, rdistrC, param_X, param_C, n = 10000, epsilon = 0.5, n_mc = 10000, theta = 1, verbose = FALSE )
rcensI( rdistrX, rdistrC, param_X, param_C, n = 10000, epsilon = 0.5, n_mc = 10000, theta = 1, verbose = FALSE )
rdistrX |
sample generator of distribution X. |
rdistrC |
sample generator of distribution C. |
param_X |
list with parameters of rdistrX function. |
param_C |
list with parameters of rdistrC function, one of these parameters |
n |
number of sample to create. |
epsilon |
Parameter to estimate the number of visit (in [0,1]), shrink it only if the algorithm takes too long |
n_mc |
number of sample use to estimate the moments of C, greater n_mc more accuracy. |
theta |
Desired censoring percentage |
verbose |
if TRUE print a censoring percentage of new created database. |
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 | |
n_censored |
number of censored samples |
Daniel Saavedra Morales
rcensT1
for generate censorship sample type I.rcensT2
for generate censorship sample type II.rcensT3
for generate censorship sample type IIIrcensIfix
for generate interval censoring sample
with fix length interval
#Example Exponential - Uniform Data_I = rcensI(rdistrX = rexp, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = 1), n = 1e02, theta = .9) ## Example with plot in examples_plot/Example_rcensI_plot.R
#Example Exponential - Uniform Data_I = rcensI(rdistrX = rexp, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = 1), n = 1e02, theta = .9) ## Example with plot in examples_plot/Example_rcensI_plot.R
Generator of interval censored samples where the length of interval is fixed, given a generator of samples of the distribution X (rdistrX) with parameters appended by the list param_X. In which, you can control the desired censorship percentage.
rcensIfix( rdistrX, param_X, interval_length, n = 10000, theta = 1, verbose = FALSE )
rcensIfix( rdistrX, param_X, interval_length, n = 10000, theta = 1, verbose = FALSE )
rdistrX |
sample generator of distribution X. |
param_X |
list with parameters of rdistrX function. |
interval_length |
length of interval |
n |
number of sample to create. |
theta |
Desired censoring percentage |
verbose |
if TRUE print a censoring percentage of new created database. |
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 | |
n_censored |
number of censored samples |
Daniel Saavedra Morales
rcensT1
for generate censorship sample type I.rcensT2
for generate censorship sample type II.rcensT3
for generate censorship sample type IIIrcensI
for generate interval censoring sample
with random length interval
#Example Exponential - Uniform Data_Ifix = rcensIfix(rdistrX = rexp, interval_length = 2, param_X = list("rate" = .5), n = 1e02, theta = .9) ## Example with plot in examples_plot/Example_rcensIfix_plot.R
#Example Exponential - Uniform Data_Ifix = rcensIfix(rdistrX = rexp, interval_length = 2, param_X = list("rate" = .5), n = 1e02, theta = .9) ## Example with plot in examples_plot/Example_rcensIfix_plot.R
Generator of censored samples type I 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 censorship time or the desired censorship percentage.
rcensT1( rdistrX, param_X, qdistrX = NULL, n = 10000, t_censored = -1, theta = 0.5, verbose = FALSE, right = TRUE )
rcensT1( rdistrX, param_X, qdistrX = NULL, n = 10000, t_censored = -1, theta = 0.5, verbose = FALSE, right = TRUE )
rdistrX |
sample generator of distribution X. |
param_X |
list with parameters of rdistrX function. |
qdistrX |
quantile function of X. |
n |
number of sample to create. |
t_censored |
time level censored. |
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 |
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 |
Daniel Saavedra Morales
rcensT2
for generate censorship sample type II.rcensT3
for generate censorship sample type IIIrcensI
for generate interval censoring sample
with random length intervalrcensIfix
for generate interval censoring sample
with fix length interval
## Example Exponential ## time censored Data_T1 = rcensT1(rdistrX = rexp, param_X = list("rate" = 2), n = 1e02, t_censored = 1) ## time censored estimate with desired censoring percentage. Data_T1 = rcensT1(rdistrX = rexp, param_X = list("rate" = 2), qdistrX = qexp, n = 1e02, theta = .8) ## Example with plot in examples_plot/Example_rcensT1_plot.R
## Example Exponential ## time censored Data_T1 = rcensT1(rdistrX = rexp, param_X = list("rate" = 2), n = 1e02, t_censored = 1) ## time censored estimate with desired censoring percentage. Data_T1 = rcensT1(rdistrX = rexp, param_X = list("rate" = 2), qdistrX = qexp, n = 1e02, theta = .8) ## Example with plot in examples_plot/Example_rcensT1_plot.R
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.
rcensT2( rdistrX, param_X, n = 10000, m_censored = -1, theta = 0.5, verbose = FALSE, right = TRUE )
rcensT2( rdistrX, param_X, n = 10000, m_censored = -1, theta = 0.5, verbose = FALSE, right = TRUE )
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 |
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 |
Daniel Saavedra Morales
rcensT1
for generate censorship sample type I.rcensT3
for generate censorship sample type IIIrcensI
for generate interval censoring sample
with random length intervalrcensIfix
for generate interval censoring sample
with fix length interval
##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
##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
Generator of censored samples type III with right or left censoring, given a generator of samples of the distribution X (rdistrX) with parameters appended by the list param_X. Also accumulate function of distribution and generator sample of distribution C (censoring) with parameters appended by the list param_C In which, you can control the desired censorship percentage.
rcensT3( rdistrX, pdistrC, rdistrC, param_X, param_C, n = 10000, theta = 0.5, n_mc = 10000, lambda_tol = c(1e-06, 10000), verbose = FALSE, right = TRUE )
rcensT3( rdistrX, pdistrC, rdistrC, param_X, param_C, n = 10000, theta = 0.5, n_mc = 10000, lambda_tol = c(1e-06, 10000), verbose = FALSE, right = TRUE )
rdistrX |
sample generator of distribution X. |
pdistrC |
function distribution of C. First argument probabilities, next arguments in param_C. |
rdistrC |
sample generator of distribution C. |
param_X |
list with parameters of rdistrX function. |
param_C |
list with parameters of rdistrC function, one of these parameters |
n |
number of sample to create. |
theta |
Desired censoring percentage |
n_mc |
number of sample use in Monte Carlo integration, greater n_mc more accuracy. |
lambda_tol |
lowest and uppest value where live the search parameter lambda. |
verbose |
if TRUE print a censoring percentage of new created database. |
right |
if TRUE create right-censored data, else create left-censored |
A list with sample data information:
lambda
|
searched censoring distribution parameter. |
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. |
Daniel Saavedra Morales
rcensT1
for generate censorship sample type I.rcensT2
for generate censorship sample type II rcensI
for generate interval censoring sample
with random length intervalrcensIfix
for generate interval censoring sample
with fix length interval
#Example Exponential - Uniform Data_T3 = rcensT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .9, right = TRUE) Data_T3 = rcensT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .1, right = FALSE) ## Example with plot in examples_plot/Example_rcensT3_plot.R
#Example Exponential - Uniform Data_T3 = rcensT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .9, right = TRUE) Data_T3 = rcensT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .1, right = FALSE) ## Example with plot in examples_plot/Example_rcensT3_plot.R
Generator Sample with Cure Fraction, given a generator of samples of the distribution X (rdistrX) with parameters appended by the list param_X. Also the proportion of cure desired p.
rcuref(rdistrX, param_X, n = 10000, p = 0.5)
rcuref(rdistrX, param_X, n = 10000, p = 0.5)
rdistrX |
sample generator of distribution X. |
param_X |
list with parameters of rdistrX function. |
n |
number of sample to create. |
p |
cure fraction |
A list with sample data information:
data_cf
|
vector of cure fraction sample. |
cure_list |
vector of 1 and 0 indicating whether the i-th sample is cured. |
1:= cure , 0:= no cure | |
cure_fraction |
cure fraction used to create de sample. |
Daniel Saavedra Morales
#Example Exponential Cure Fraction p = 0.5 Data = rcuref(rdistrX = rexp, param_X = list("rate" = 1), n = 1000, p = 0.5)
#Example Exponential Cure Fraction p = 0.5 Data = rcuref(rdistrX = rexp, param_X = list("rate" = 1), n = 1000, p = 0.5)
Generator Sample with Cure Fraction, Random Censoring.
Given a generator of samples of the distribution X (rdistrX) with
parameters appended by the list param_X. Also accumulate function of distribution and generator sample
of distribution C (censoring) with parameters appended by the list param_C
In which, you can control the desired censorship percentage.
Note: cure fraction (p) must be less than desired censorship percentage.
rcurefT3( rdistrX, pdistrC, rdistrC, param_X, param_C, p = 0.1, n = 10000, theta = 0.5, n_mc = 10000, lambda_tol = c(1e-06, 10000), verbose = FALSE, right = TRUE )
rcurefT3( rdistrX, pdistrC, rdistrC, param_X, param_C, p = 0.1, n = 10000, theta = 0.5, n_mc = 10000, lambda_tol = c(1e-06, 10000), verbose = FALSE, right = TRUE )
rdistrX |
sample generator of distribution X. |
pdistrC |
function distribution of C. First argument probabilities, next arguments in param_C. |
rdistrC |
sample generator of distribution C. |
param_X |
list with parameters of rdistrX function. |
param_C |
list with parameters of rdistrC function, one of these parameters |
p |
cure fraction |
n |
number of sample to create. |
theta |
Desired censoring percentage |
n_mc |
number of sample use in Monte Carlo integration, greater n_mc more accuracy. |
lambda_tol |
lowest and uppest value where live the search parameter lambda. |
verbose |
if TRUE print a censoring percentage of new created database. |
right |
if TRUE create right-censored data, else create left-censored |
A list with sample data information:
lambda
|
searched censoring distribution parameter. |
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. |
cure_list |
vector of 1 and 0 indicating whether the i-th sample is cured. |
1:= cure , 0:= no cure | |
cure_fraction |
cure fraction used to create de sample. |
Daniel Saavedra Morales
rcuref
Generate Sample with Cure Fraction.
#Example Exponential - Uniform Data_T3 = rcurefT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .9, p = 0.2) ## Example with plot in examples_plot/Example_rcurefT3_plot.R
#Example Exponential - Uniform Data_T3 = rcurefT3(rdistrX = rexp, pdistrC = punif, rdistrC = runif, param_X = list("rate" = 2), param_C = list("min" = 0, "max" = "lambda"), n = 1e02, theta = .9, p = 0.2) ## Example with plot in examples_plot/Example_rcurefT3_plot.R