SimSurv {prodlim} | R Documentation |
Censored event times are drawn from user specified conditional distributions given simulated covariates.
SimSurv(N, surv = list(dist="rweibull", args=list(shape=1), baseline=1, link="exp", coef=1, transform=NULL, method="simulation"), cens = list(dist="rexp", args=NULL, baseline=1/100, link="exp", max=NULL, type="right", coef=0, transform=NULL, method="transform"), cova = list(X1=list("rnorm",mean=0,sd=2), X2=list("rbinom",size=1,prob=.5)), verbose=1, ...)
N |
Sample size |
surv |
A list with the following arguments
cova |
cens |
A list with the following elements
cova |
cova |
either a matrix with N rows,
or a named list to generate the covariates. each entry
is a list where the first element is the names of the
function used to draw the covariate values and the remaining
elements are arguments passed to that function. For example
cova=list(X = list(dist = "rlnorm", meanlog = 2, sdlog = 0.4))
generates a single log-normally distributed covariate called
X .
|
verbose |
Set to FALSE to shut up in simulations |
... |
used for convenient argument specification, e.g.
surv.transform.X2=function(x)x^2
will overwrite a corresponding entry
of surv for the transform of the
covariate X2
|
Possible distributions to generate covariates:
X.lognorm = list(dist = "rlnorm", meanlog = 2, sdlog = 0.4)
X.unif = list(dist = "runif", min = 0, max = 10),
X.exp = list(dist = "rexp", rate = 0.4)
X.bernoulli = list(dist = "rbinom", size = 1, prob = 0.3)
X.binom = list(dist = "rbinom", size = 4, prob = 0.8)
X.nbinom = list(dist = "rnbinom", size = 3, mu = 2)
X.poisson = list(dist = "rpois", lambda = 1.3)
A data.frame:
time |
the right censored event times |
status |
the survival status |
X |
the values of the covariate X |
f.X |
the transformed values of the covariate X |
time |
the uncensored event times |
formula |
a formula to evaluate the generated event history object
Thomas A. Gerds tag@biostat.ku.dk
Ralf Bender, Thomas Augustin, and Maria Blettner. Generating survival times to simulate Cox proportional hazards models by Ralf Bender, Thomas Augustin and Maria Blettner, Statistics in Medicine 2005; 24:1713-1723. Stat Med, 25(11):1978-9, 2006.
SimSurv(10) SurvData=SimSurv(100,cens.baseline=1/10,surv.baseline=2) Hist(SurvData$time,SurvData$status) prodlim(Hist(time,status)~1,data=SurvData) plot(prodlim(Hist(time,status)~1,data=SurvData)) plot(SurvData,atrisk=FALSE,legend=FALSE) SurvData=SimSurv(100,cens.baseline=1/10,surv.baseline=2,surv.coef=c(-1,-2), cova=list( X.exp = list(dist = "rexp", rate = 0.4), X.bernoulli = list(dist = "rbinom", size = 1, prob = 0.3))) SurvData=SimSurv(100,cens.baseline=1/10,surv.baseline=2,surv.coef=c(-1,-2),cens.coef=c(0,1), cova=list( X.exp = list(dist = "rexp", rate = 0.4), X.bernoulli = list(dist = "rbinom", size = 1, prob = 0.3))) coxph(Surv(time,status==0)~X.exp+X.bernoulli,data=SurvData) coxph(Surv(time,status)~X.exp+X.bernoulli,data=SurvData)