sim.sample: Simulated survival data generator

Description Usage Arguments Details Value See Also Examples

Description

Generates a simulated sample of clustered survival data, allowing for flexible baseline hazard and frailty distributions.

Usage

1
sim.sample(m = 10, Ji = rep(5,10), params=NULL)

Arguments

m

an integer, number of clusters in the sample.

Ji

a vector of length m containing the number of subjects in each cluster.

params

a list, optionally containing the parameters that specify the covariate distribution, baseline hazard, frailty distribution, and censoring time, as follows:

beta

the “true” value of the single covariate.

haz.type

a string specifying the type of hazard to be used.

haz.params

a list with parameters corresponding to the hazard type.

frail.type

a string specifying the type of frailty to be used.

frail.params

a list with parameters corresponding to the frailty type.

Z.type

a string specifying the type of covariate to be used.

Z.params

a list with parameters corresponding to the covariate type.

C.type

a string specifying the type of censoring to be used.

C.params

a list with parameters corresponding to the censoring type.

The default corresponds to standard normal covariates, a Weibull hazard, gamma frailties and a Weibull censoring time. See details.

Details

The possible values for frail.type, Z.type, C.type and the corresponding entries in frail.params, Z.params and C.params are as follows:

*.type="fixed"

*.params is a list with component value, containing the fixed value.

*.type="weibull"

*.params is a list with components lambda0 and gamweib, for components λ and γ of the Weibull distribution.

*.type="gamma", *.type="normal", *.type="lognormal"

*.params is a list with components mu and sigma2, giving the mean and variance of the gamma, normal or lognormal distribution desired.

*.type="normmix", *.type="lognormmix"

*.params is a list of with components mu, sigma2 and w, all vectors of the same length, giving the mean, variance and weight of each component of the normal or lognormal mixture.

For haz.type, the possible values and parameters are:

haz.type="weibull"

haz.params is a list with components lambda0 and gamweib, for components λ and γ of the Weibull distribution.

haz.type="stepfunction"

haz.params is a list with vectors breaks giving the positions of jumps in the stepfunction, and haz giving the initial value of the hazard and its value after each jump.

haz.type="bspline"

haz.params is a list with components b, a basis matrix generated by bs specifying the B-spline basis, and w, a vector of weights for each basis element.

Value

A list with three components:

agdata

a data.frame in with columns

i

cluster id

j

patient id within the cluster

time

time of event

delta

censoring indicator

Z

value of the covariate

Ui

a vector of frailties used in the simulation

params

the set of parameters in the format of the input params. See details.

See Also

splinesurv

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
    # Generate a simulated sample with default parameters
    # (Weibull baseline and gamma frailty)
    s <- sim.sample(m = 10, Ji = rep(10,10))
    plot(survfit(coxph(Surv(time,delta) ~ Z + frailty(i), data = s$agdata)))
    
    # Generate a sample with piecewise baseline hazard and
    # lognormal mixture frailties
    s2 <- sim.sample(m = 10, Ji = rep(10,10), params = list(
        haz.type = "stepfunction", haz.params = list(breaks = c(.25, .5), 
        haz = c(1, 0 , 2)), frail.type = "lognormmix", 
        frail.params = list(mu = c(.5, 2), sigma2 = c(.2, .2), 
        w = c(.666, .333))))
    plot(survfit(coxph(Surv(time,delta) ~ Z + frailty(i), data = s2$agdata)))   

splinesurv documentation built on May 2, 2019, 4:57 p.m.