Description Usage Arguments Details Value See Also Examples
Generates a simulated sample of clustered survival data, allowing for flexible baseline hazard and frailty distributions.
1 | sim.sample(m = 10, Ji = rep(5,10), params=NULL)
|
m |
an integer, number of clusters in the sample. |
Ji |
a vector of length |
params |
a list, optionally containing the parameters that specify the covariate distribution, baseline hazard, frailty distribution, and censoring time, as follows:
The default corresponds to standard normal covariates, a Weibull hazard, gamma frailties and a Weibull censoring time. See 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.
A list with three components:
agdata |
a data.frame in with columns
|
Ui |
a vector of frailties used in the simulation |
params |
the set of parameters in the format of the input |
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)))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.