Simulate data from a joint model with multiple longitudinal biomarkers and either a single time-to-event outcome or competing risks outcomes. The longitudinal biomarkers are generated from biomarker-specific linear mixed-effects models, allowing different random-effects structures across biomarkers. The event-time process is generated from cause-specific proportional hazards models with associations induced through the biomarker-specific random-effects contribution or current biomarker value at a landmark time.
simmvJMdatalm(
seed = 100,
N = 200,
increment = 0.7,
beta = list(beta1 = c(5, 1.5, 2, 1), beta2 = c(10, 1, 2, 1)),
sigma = c(0.5, 0.5),
gamma1 = c(1, 0.5),
gamma2 = c(-0.5, 0.5),
alpha1 = list(alpha11 = c(0.5), alpha12 = c(-0.5)),
alpha2 = list(alpha21 = c(0.5), alpha22 = c(-0.5)),
lambda1 = 0.05,
lambda2 = 0.025,
CL = 5,
CU = 10,
covb = diag(rep(1, 4)),
missprob = 0,
landmark = TRUE,
s = NULL,
method = "presentlp",
pRE = NULL,
CR = TRUE
)A list with two elements:
A data frame containing survival data, including subject ID, observed event or censoring time, event indicator, and baseline covariates.
A long-format data frame containing longitudinal biomarker measurements, visit times, subject ID, and baseline covariates.
Integer specifying the random seed used for data simulation.
Integer specifying the sample size.
Numeric scalar specifying the time increment between scheduled longitudinal measurements.
A list of numeric vectors specifying the true fixed-effect parameters for the longitudinal submodels. Each list component corresponds to one biomarker. The entries are interpreted as the intercept, covariate effects, and time effect; if quadratic time is included, the final entry corresponds to the quadratic time effect.
Numeric vector specifying the measurement error variances for
the longitudinal biomarkers. The length of sigma should equal the
number of biomarkers.
Numeric vector specifying the true survival fixed-effect parameters for failure type 1.
Numeric vector specifying the true survival fixed-effect
parameters for failure type 2. Used when CR = TRUE.
A list of numeric vectors specifying the true association
parameters between the longitudinal biomarkers and failure type 1. Each
component corresponds to one biomarker and should have length matching the
corresponding entry of pRE.
A list of numeric vectors specifying the true association
parameters between the longitudinal biomarkers and failure type 2. Each
component corresponds to one biomarker and should have length matching the
corresponding entry of pRE. Used when CR = TRUE.
Numeric scalar specifying the constant baseline hazard rate for failure type 1. An exponential baseline hazard is assumed.
Numeric scalar specifying the constant baseline hazard rate
for failure type 2. An exponential baseline hazard is assumed. Used when
CR = TRUE.
Numeric scalar specifying the lower bound of the uniform distribution used to generate censoring times.
Numeric scalar specifying the upper bound of the uniform distribution used to generate censoring times.
Variance-covariance matrix for the subject-specific random
effects. Its dimension must be equal to sum(pRE).
Numeric scalar between 0 and 1 specifying the probability
that a scheduled longitudinal observation is missing. Default is 0.
Logical; if TRUE, event times and censoring times are
generated conditional on survival beyond a landmark time s. Default
is TRUE.
Numeric scalar specifying the landmark time. Required when
landmark = TRUE. Default is NULL.
Character string specifying how the longitudinal process is
linked to the event-time process. Options are "presentlp" and
"present". If method = "presentlp", the event-time model
depends on the subject-specific random-effects contribution at the landmark
time. If method = "present", the event-time model depends on the full
current biomarker value at the landmark time, including both fixed- and
random-effects components. Default is "presentlp".
Integer vector specifying the number of random effects for each
biomarker. For example, pRE = c(1, 2) specifies a random-intercept
model for biomarker 1, a random intercept-and-slope model for biomarker 2.
If NULL, a random-intercept model is assumed for
each biomarker. The sum of pRE must equal the dimension of
covb. Default is NULL.
Logical; if TRUE, simulate competing risks data with two
failure types. If FALSE, simulate a single failure type with
independent censoring. Default is TRUE.
Shanpeng Li lishanpeng0913@ucla.edu
Simulate multivariate longitudinal and time-to-event data from a joint model
The function generates two baseline covariates, X1 and X2.
The longitudinal biomarkers are generated from biomarker-specific linear
mixed-effects models. The number of random effects for each biomarker is
controlled by pRE. Currently, pRE values of 1 and 2 are
supported, corresponding respectively to random intercept, random intercept
and slope.
When landmark = TRUE, event and censoring times are generated after
the landmark time s. Under method = "presentlp", the survival
model uses only the random-effects contribution evaluated at s. Under
method = "present", the survival model uses the full current
biomarker value at s.
if (FALSE) {
dat <- simmvJMdatalm(
seed = 100,
N = 5000,
increment = 0.7,
beta = list(
beta1 = c(5, 1.5, 2, 1),
beta2 = c(10, 1, 2, 1),
beta3 = c(8, 1.2, 1.5, 0.8)
),
sigma = rep(1, 3),
gamma1 = c(1, 0.5),
gamma2 = c(-0.5, 0.5),
alpha1 = list(
alpha11 = -0.5,
alpha12 = c(0.5, 0.7),
alpha13 = c(0.3, 0.4)
),
alpha2 = list(
alpha21 = 0.5,
alpha22 = c(0.5, 0.8),
alpha23 = c(0.3, 0.1)
),
lambda1 = 0.05,
lambda2 = 0.05,
covb = diag(c(5, 10, 1, 10, 1)),
pRE = c(1, 2, 2),
s = 2,
landmark = TRUE,
CR = TRUE
)
mvydata <- dat$mvydata
mvcdata <- dat$mvcdata
}
Run the code above in your browser using DataLab