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 = 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,
        ...)

Arguments

N Sample size
surv A list with the following arguments
dist
name of the function to draw the survival distribution
args
list of extra arguments to `dist'
baseline
the baseline risk
link
names of the link to the covariates
coef
numeric vector of regression coefficients. the ith is used for the ith entry of cova
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. the second
cens A list with the following elements
dist
name of the function to draw the censoring distribution
args
list of extra arguments to `dist'
baseline
the baseline risk
link
names of the link to the covariates
max
maximal value where all event times are right censored
type
"right" for right censored data, "interval" for interval censored data
coef
numeric vector of regression coefficients. the ith is used for the ith entry of cova
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.
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

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

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

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


[Package prodlim version 1.0.5 Index]