simulate {JM} | R Documentation |
Simulate from Joint Models.
Description
simulate longitudinal responses and event times from joint models
Usage
simulateJM(nsim, nsub, thetas, times, formulas, Data = NULL,
method = c("weibull-PH", "weibull-AFT", "piecewise-PH", "spline-PH"),
lag = 0, censoring = "uniform", max.FUtime = NULL, seed = NULL,
return.ranef = FALSE)
## S3 method for class 'jointModel'
simulate(object, nsim, seed = NULL, times = NULL,
Data = NULL, ...)
Arguments
nsim |
number of data sets to be simulated. |
nsub |
the number of subjects in each data set. |
thetas |
a list with the parameter values. This should be of the same structure as
the |
times |
a numeric vector denoting the time points at which longitudinal measurements are planned to be taken. |
formulas |
a list with components: |
Data |
a data frame containing any covariates used in the formulas defined in the
|
method |
a character string indicating from what type of survival submodel to simulate.
There are the same options as the ones provided by |
lag |
a numeric value denoting a lagged effect; the same as the |
censoring |
a character string or a numeric vector. |
max.FUtime |
a numeric value denoting the maximum follow-up time for the study. The default
is |
seed |
an object specifying if and how the random number generator should
be initialized ('seeded'). It could be either |
return.ranef |
logical; if |
object |
an object inheriting from class |
... |
additional arguments; currently none is used. |
Value
A list of length nsim
of data frames that contains the simulated responses
for the longitudinal process "y", the simulated event times "Time", the event indicator
"Event", and the subject identification number "id". If extra covariates were assumed,
these are also included.
Author(s)
Dimitris Rizopoulos d.rizopoulos@erasmusmc.nl
See Also
Examples
## Not run:
prothro$t0 <- as.numeric(prothro$time == 0)
lmeFit <- lme(pro ~ treat * (time + t0), random = ~ time | id, data = prothro)
survFit <- coxph(Surv(Time, death) ~ treat, data = prothros, x = TRUE)
jointFit <- jointModel(lmeFit, survFit, timeVar = "time",
method = "weibull-PH-aGH")
newData <- simulate(jointFit, nsim = 1, times = seq(0, 11, len = 15))
newData
## End(Not run)