simfms: Simulation of clustered multi-state data

Description Usage Arguments Value Author(s) References See Also Examples

View source: R/simfms.R

Description

Random generation of survival data with a clustered and multi-state structure.

The simulation procedure is based on a copula model for each competing events block, allowing to specify the marginal distributions of time variables.

The effect of simulated frailties and covariates can be added in a proportional hazards way.

Usage

1
2
3
4
5
6
7
8
simfms(nsim = NULL, tmat = NULL, clock = "forward", 
       frailty = list(dist="gamma", par= .5, type="shared"), 
       nclus = NULL, csize = NULL, 
       covs = NULL, beta = NULL, 
       marg = list(dist = "weibull", lambda = 1, rho = 1), 
       cens = list(dist = "weibull", lambda = 1, rho = 1, admin = 72), 
       copula = list(name = "clayton", par = 1),
       format = "long")

Arguments

nsim

The number of subjects to simulate

tmat

The transitions matrix

clock

The approach to be used for tractation of baseline hazards and generation of times:

reset generates times at each step ranging from 0 to infinity and adds them to those of previous transitions
forward generates times at each step, conditional on the time of entering the present state
frailty

The frailty term specifications. A list with components:

  • dist: the name of the frailty distribution (only gamma implemented at now)

  • par: the frailty parameter(s) value

  • type: the type of frailty

    • shared: iid and shared by the times of transitions of any type, for all subjects in a group

    • iid: iid and shared by the times of transitions of the same type, for all subjects in a group (possible different frailty parameters for different transition types)

    • nested: id and correlated by means of nested frailties (possible different frailty parameters for different transition types)

nclus

The number of clusters to simulate

csize

The size(s) of cluster

covs

The covariates to simulate. A list with components nameOfCovariate = simulationfunction

beta

The regression coefficients for covariates. A list of the same length as covs, with elements nameOfCovariate, vectors of the same length as the number of transitions max(tmat, na.rm=TRUE)

marg

The marginal baseline hazards. A list with components

  • dist: the name of the baseline hazard distributions (one value for all transitions)

  • eachpar: each baseline parameter (either one value or as many as the number of transitions in codetmat)

cens

The censoring time distributions. A list with components

  • dist: the name of the censoring distributions (one value for all transitions)

  • eachpar: each censoring distribution parameter (either one value or as many as the number of possible starting states in tmat, possibly with states' names)

copula

The copula model. A list with components

  • name: the name of the copula (only clayton available at now)

  • par: the copula parameter

format

the data format, either long or wide

Value

A data.frame containing the simulated data, with columns

Author(s)

Federico Rotolo <federico.rotolo@stat.unipd.it>

References

Rotolo, F, Legrand, Catherine, Van Keilegom, I (2012) Simulation of clustered multi-state survival data based on a copula model. Submitted

See Also

trans.cancer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
################################################################################
### - Cancer reduced multi-state structure - ###################################
################################################################################
trans.cancer.reduced()
simfms(nsim  = NULL,
       tmat  = trans.cancer.reduced(),
       clock = "forward",
       frailty = list(dist="gamma", par= .5),
       nclus = 5,
       csize = 2,
       covs = list(age=function(x) rnorm(x, mean=60, sd=7),
                   treat=function(x) rbinom(x, 1, .5)),
       beta = list(age=rep(.02,5), treat=rep(2,5)),
       marg  = list(dist="weibull", lambda=1, rho=1), 
       cens  = list(dist="weibull", lambda=1, rho=1, admin= 72),
       copula= list(name="clayton", par= 1))


################################################################################
### - Cancer standard multi-state structure - ##################################
################################################################################
trans.cancer()
simfms(nsim  = NULL,
       tmat  = trans.cancer(),
       clock = "forward",
       frailty = list(dist="gamma", par= .5),
       nclus = 5,
       csize = 2,
       covs = list(age=function(x) rnorm(x, mean=60, sd=7),
                   treat=function(x) rbinom(x, 1, .5)),
       beta = list(age=rep(.02, 8), treat=rep(2, 8)),
       marg  = list(dist="weibull", lambda=1, rho=1), 
       cens  = list(dist="weibull", lambda=1, rho=1,  admin= 72),
       copula= list(name="clayton", par= 1))


################################################################################
### - Cancer extended multi-state structure - ##################################
################################################################################
trans.cancer.extended()
simfms(nsim  = NULL,
       tmat  = trans.cancer.extended(),
       clock = "forward",
       frailty = list(dist="gamma", par= .5),
       nclus = 5,
       csize = 2,
       covs = list(age=function(x) rnorm(x, mean=60, sd=7),
                   treat=function(x) rbinom(x, 1, .5)),
       beta = list(age=rep(.02, 9), treat=rep(2, 9)),
       marg  = list(dist="weibull", lambda=1, rho=1), 
       cens  = list(dist="weibull", lambda=1, rho=1, admin= 72),
       copula= list(name="clayton", par= 1))

simfms documentation built on May 2, 2019, 6:50 p.m.