simfrail {frailtySurv} | R Documentation |
Simulate survival data and fit models
Description
Generates simulated clustered survival data by repeatedly generating data, using a shared frailty model, and fitting the models. Respective arguments are passed to genfrail and fitfrail, and the resulting parameter estimates are aggregated and summarized.
Usage
simfrail(reps, genfrail.args, fitfrail.args, Lambda.times,
vcov.args = list(), cores = 0, skip.SE = FALSE)
Arguments
reps |
number of times to repeat the simulation |
genfrail.args |
list of arguments to pass to |
fitfrail.args |
list of arguments to pass to |
Lambda.times |
vector of time points to obtain baseline hazard estimates at |
vcov.args |
list of arguments to pass to vcov.fitfrail for variance estimates. This is mainly used to specify whether bootstrap or estimated variances should be obtained. |
cores |
integer; if > 0, the number of cores to use; if < 0, the number of cores not to use; if 0, use all available cores |
skip.SE |
logical value, whether to skip the standard error estimates (saves time) |
Value
A simfrail
object that is essentially a data.frame
of the resulting parameter estimates. Each row is a single run, and columns are as follows.
seed |
the seed used for the run |
runtime |
the time it took to fit the model |
N |
number of clusters |
mean.K |
average cluster size |
cens |
empirical censorship |
beta |
true regression coefficients |
hat.beta |
estimated regression coefficients |
se.beta |
standard error of each regression coefficient |
theta |
true frailty distribution parameters |
hat.theta |
estimated frailty distribution parameters |
se.theta |
standard error of each frailty distribution parameter |
Lambda |
true cumulative baseline hazard at each Lambda.times point |
hat.Lambda |
estimated cumulative baseline hazard at each Lambda.times point |
se.Lambda |
standard error at each Lambda.times point |
Author(s)
John. V Monaco, Malka Gorfine, Li Hsu
See Also
Examples
## Not run:
sim <- simfrail(reps=100,
genfrail.args=alist(
N=50, K=2,
beta=c(log(2),log(3)),
frailty="gamma", theta=2,
Lambda_0 = function(t, tau=4.6, C=0.01) (C*t)^tau),
fitfrail.args=alist(
formula=Surv(time, status) ~ Z1 + Z2 + cluster(family),
frailty="gamma"),
Lambda.times=1:120, cores = 0)
# Summarize the results
summary(sim)
# Plot the residuals
plot(sim, "residuals")
## End(Not run)