dataCox {coxphSGD} | R Documentation |
Cox Proportional Hazards Model Data Generation From Weibull Distribution
Description
Function dataCox
generaters random survivaldata from Weibull
distribution (with parameters lambda
and rho
for given input
x
data, model coefficients beta
and censoring rate for censoring
that comes from exponential distribution with parameter cens.rate
.
Usage
dataCox(n, lambda, rho, x, beta, cens.rate)
Arguments
n |
Number of observations to generate. |
lambda |
lambda parameter for Weibull distribution. |
rho |
rho parameter for Weibull distribution. |
x |
A data.frame with an input data to generate the survival times for. |
beta |
True model coefficients. |
cens.rate |
Parameter for exponential distribution, which is responsible for censoring. |
Details
For each observation true survival time is generated and a censroing time. If censoring time is less then survival time, then the survival time
is returned and a status of observations is set to 0
which means the
observation had censored time. If the survival time is less than censoring
time, then for this observation the true survival time is returned and the
status of this observation is set to 1
which means that the event has
been noticed.
Value
A data.frame
containing columns:
-
id
an integer. -
time
survival times. -
status
observation status (event occured (1) or not (0)). -
x
adata.frame
with an input data to generate the survival times for.
References
http://onlinelibrary.wiley.com/doi/10.1002/sim.2059/abstract
Generating survival times to simulate Cox proportional hazards models
, 2005 by Ralf Bender, Thomas Augustin, Maria Blettner.
Examples
## Not run:
x <- matrix(sample(0:1, size = 20000, replace = TRUE), ncol = 2)
dataCox(10^4, lambda = 3, rho = 2, x,
beta = c(1,3), cens.rate = 5) -> dCox
## End(Not run)