SimSurv {prodlim}R Documentation

Simulating survival data

Description

Censored event times are drawn from user specified conditional distributions given simulated covariates.

Usage

SimSurv(N,
        surv,
        cens,
        cova,
        verbose=1,
        ...)

Arguments

N Sample size
surv Dummy argument. The survival distribution is determined by arguments of the form surv.arg. See Details
cens If FALSE data are left uncensored. Otherwise the censoring distribution is specified by using arguments of the form cens.arg. See Details.
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

Details

surv.dist name of the function to draw the survival distribution surv.baseline the baseline risk surv.link names of the link to the covariates surv.coef numeric vector of regression coefficients. the ith is used for the ith entry of cova surv.transform list of function names one for each covariate. the ith is applied to values of the ith covariate before it is linked to generate the survival times. cens.dist name of the function to draw the censoring distribution cens.args list of extra arguments to dist cens.baseline the baseline risk cens.link names of the link to the covariates cens.max maximal value where all event times are right censored cens.type "right" for right censored data, "interval" for interval censored data cens.coef numeric vector of regression coefficients. the ith is used for the ith entry of cova cens.transformlist of function names one for each covariate, where the ith element is applied to values of the ith covariate before it is linked to generate the survival times.

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)

Value

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


Attributes of the data.frame formula a formula to evaluate the generated event history object

Author(s)

Thomas A. Gerds tag@biostat.ku.dk

References

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.

See Also

prodlim

Examples

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)))

## Not run: 
coxph(Surv(time,status==0)~X.exp+X.bernoulli,data=SurvData)

coxph(Surv(time,status)~X.exp+X.bernoulli,data=SurvData)
## End(Not run)

[Package prodlim version 1.1.3 Index]