Description Usage Arguments Value Note Author(s) References See Also Examples
Implements a function to draw censored random samples, with a desired censoring rate, when the event times are any continuous lifetime distribution supported by R. The one-parameter Lindley, uniform and exponential are the distributions that can be used as the censoring distributions.
1 2 | randcensor(n, pcens = 0.1, timedistr = "lindley", censordistr = "lindley",
...)
|
n |
number o generated observations. |
pcens |
desired censoring rate. |
timedistr |
a character string |
censordistr |
a character string |
... |
parameters that define the event time distribution (timedistr). Must be provided in the same way as it is in built in R functions. |
randcensor
returns a list with the timedistr distribution, the censordistr distribution, the calculated parameter of the censordist distribution and n observations which is either the lifetime (delta = 1) or a censored lifetime (delta = 0).
Invalid arguments will return an error message.
Finds the parameter of the censoring distribution using integrate
and uniroot
.
Josmar Mazucheli jmazucheli@gmail.com
Klein, J. P., Moeschberger, M. L., (2003). Survival Analysis: Techniques for Censored and Truncated Data, 2nd Edition. Springer-Verlag, New York.
Lawless, J. F., (2003). Statistical models and methods for lifetime data, 2nd Edition. Wiley Series in Probability and Statistics. John Wiley & Sons, Hoboken, NJ.
Meeker, W. Q., Escobar, L. A., (1998). Statistical Methods for Reliability Data. John Wiley and Sons, New York.
Distributions
, fitdistcens
, integrate
, Lindley
, uniroot
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | x <- randcensor(n = 100, pcens = 0.2, timedistr = 'lindley', censordistr = 'lindley',
theta = 1.5)
table(x$data['delta']) / 100
x <- randcensor(n = 100, pcens = 0.2, timedistr = 'wlindley', censordistr = 'lindley',
theta = 1.5, alpha = 0.5)
table(x$data['delta']) / 100
x <- randcensor(n = 100, pcens = 0.2, timedistr = 'weibull', censordistr = 'lindley',
shape = 0.5, scale = 1.5)
table(x$data['delta']) / 100
x <- randcensor(n = 100, pcens = 0.2, timedistr = 'lnorm', censordistr = 'unif',
meanlog = 1, sdlog = 1)
table(x$data['delta']) / 100
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.