simulate: Simulate from Joint Models.

simulateR 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 coefficients component returned by jointModel().

times

a numeric vector denoting the time points at which longitudinal measurements are planned to be taken.

formulas

a list with components: Yfixed a formula for the fixed-effects part of the linear mixed model, Yrandom a formula for the random-effects part of the linear mixed model, Tfixed a formula for the baseline covariates part of the survival submodel, timeVar a character string indicating the name of the time variable in the linear mixed model.

Data

a data frame containing any covariates used in the formulas defined in the formulas argument.

method

a character string indicating from what type of survival submodel to simulate. There are the same options as the ones provided by jointModel.

lag

a numeric value denoting a lagged effect; the same as the lag argument of jointModel.

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 max(times) + 2 * IQR(times).

seed

an object specifying if and how the random number generator should be initialized ('seeded'). It could be either NULL or an integer that will be used in a call to set.seed() before simulating the response vectors. If set, the value is saved as the "seed" attribute of the returned value.

return.ranef

logical; if TRUE, each component of the returned list has the attributed "ranef" that contains the random-effects values used in the simulation.

object

an object inheriting from class jointModel.

...

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

jointModel

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)

drizopoulos/JM documentation built on Aug. 10, 2022, 1:51 a.m.