Learn R Programming

FastJM (version 1.7.0)

simmvJMdatalm: Data simulation for multivariate joint models conditional on a landmark time

Description

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.

Usage

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
)

Value

A list with two elements:

mvcdata

A data frame containing survival data, including subject ID, observed event or censoring time, event indicator, and baseline covariates.

mvydata

A long-format data frame containing longitudinal biomarker measurements, visit times, subject ID, and baseline covariates.

Arguments

seed

Integer specifying the random seed used for data simulation.

N

Integer specifying the sample size.

increment

Numeric scalar specifying the time increment between scheduled longitudinal measurements.

beta

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.

sigma

Numeric vector specifying the measurement error variances for the longitudinal biomarkers. The length of sigma should equal the number of biomarkers.

gamma1

Numeric vector specifying the true survival fixed-effect parameters for failure type 1.

gamma2

Numeric vector specifying the true survival fixed-effect parameters for failure type 2. Used when CR = TRUE.

alpha1

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.

alpha2

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.

lambda1

Numeric scalar specifying the constant baseline hazard rate for failure type 1. An exponential baseline hazard is assumed.

lambda2

Numeric scalar specifying the constant baseline hazard rate for failure type 2. An exponential baseline hazard is assumed. Used when CR = TRUE.

CL

Numeric scalar specifying the lower bound of the uniform distribution used to generate censoring times.

CU

Numeric scalar specifying the upper bound of the uniform distribution used to generate censoring times.

covb

Variance-covariance matrix for the subject-specific random effects. Its dimension must be equal to sum(pRE).

missprob

Numeric scalar between 0 and 1 specifying the probability that a scheduled longitudinal observation is missing. Default is 0.

landmark

Logical; if TRUE, event times and censoring times are generated conditional on survival beyond a landmark time s. Default is TRUE.

s

Numeric scalar specifying the landmark time. Required when landmark = TRUE. Default is NULL.

method

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".

pRE

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.

CR

Logical; if TRUE, simulate competing risks data with two failure types. If FALSE, simulate a single failure type with independent censoring. Default is TRUE.

Author

Shanpeng Li lishanpeng0913@ucla.edu

Details

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.

Examples

Run this code
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