Learn R Programming

FastJM (version 1.7.0)

mvjmcs: Joint modeling of multivariate longitudinal and competing risks data

Description

Joint modeling of multivariate longitudinal and competing risks data

Usage

mvjmcs(
  ydata,
  cdata,
  long.formula,
  random = NULL,
  surv.formula,
  control = mvjmcs_control(),
  latAsso = "sre",
  landmark = FALSE,
  s = NULL,
  ytime = NULL
)

Value

An object of class mvjmcs, returned as a list containing:

beta

The vector of all biomarker-specific fixed effects for the linear mixed-effects submodels.

betaList

The list of biomarker-specific fixed effects for the linear mixed-effects submodels.

gamma1

The vector of fixed effects for type 1 failure in the survival submodel.

gamma2

The vector of fixed effects for type 2 failure in the survival submodel. Valid only if CompetingRisk = TRUE.

alpha1

The vector of association parameters for type 1 failure.

alpha2

The vector of association parameters for type 2 failure. Valid only if CompetingRisk = TRUE.

H01

The matrix of baseline hazards evaluated at uncensored event times for type 1 failure.

H02

The matrix of baseline hazards evaluated at uncensored event times for type 2 failure. Valid only if CompetingRisk = TRUE.

Sig

The variance-covariance matrix of the random effects.

sigma

The vector of biomarker-specific measurement-error variances.

iter

The total number of iterations until convergence.

convergence

Convergence identifier: 1 indicates successful convergence, whereas 0 indicates a convergence problem, often requiring more iterations.

tol

the convergence parameter.

vcov

The variance-covariance matrix of all fixed-effect parameters.

FisherInfo

The empirical Fisher information matrix.

Score

A matrix of subject-specific score contributions.

sebeta

The standard errors of beta.

segamma1

The standard errors of gamma1.

segamma2

The standard errors of gamma2. Valid only if CompetingRisk = TRUE.

sealpha1

The standard errors of alpha1.

sealpha2

The standard errors of alpha2. Valid only if CompetingRisk = TRUE.

seSig

The vector of standard errors for covariance parameters of the random effects.

sesigma

The standard errors of biomarker-specific measurement-error variances.

pos.mode

The posterior mode of the conditional distribution of random effects.

pos.cov

The posterior covariance of the conditional distribution of random effects.

CompetingRisk

Logical value indicating whether competing events are modeled.

ydata

The input longitudinal dataset, reordered according to descending observation times in cdata.

cdata

The input survival dataset, reordered according to descending observation times.

PropEventType

A frequency table of event types.

LongitudinalSubmodel

The longitudinal submodel specified by long.formula.

SurvivalSubmodel

The survival submodel specified by surv.formula.

random

The random-effects specification.

control

The fitting-control options used.

call

The matched function call.

id

The grouping vector for the longitudinal outcomes.

runtime

The total computation time.

latAsso

The pre-specified latent association structure.

landmark

The logical value indicating whether landmarking is used.

s

The pre-specified landmark time.

ytime

The name of the longitudinal time variable.

Arguments

ydata

A longitudinal data frame in long format.

cdata

A survival data frame with competing risks or single failure. Each subject has one data entry.

long.formula

A list of formula objects specifying fixed effects for each longitudinal outcome.

random

A formula or list of formulas describing random-effects structures. For example, a random-intercept model can be specified as ~ 1 | ID.

surv.formula

A formula object specifying the survival time, event indicator, and covariates in the survival submodel.

control

A list of fitting-control options, typically generated by mvjmcs_control(). Available options include:

maxiter

Maximum number of EM iterations. The default is 10000.

opt

Optimization method used to fit the initial mixed-effects models. Available options are "nlminb" and "optim". The default is "nlminb".

tol

Convergence tolerance for the EM algorithm. The default is 0.005.

verbose

Logical value indicating whether to print iteration details. The default is FALSE.

initial.para

Optional list of user-supplied initial parameter values for the EM algorithm. The default is NULL.

cpu.cores

Number of CPU cores used for parallel computation. The default is NULL.

latAsso

Latent association structure. Options are "sre", "present", and "presentlp". The default is "sre".

landmark

Logical value indicating whether landmarking is used. The default is FALSE.

s

Landmark time. Required when landmark = TRUE and latAsso is "present" or "presentlp".

ytime

Name of the longitudinal time variable. Required when landmarking is used.

Examples

Run this code
  require(FastJM)
  require(survival)
  require(future)
  require(future.apply)
  
  data(mvcdata)
  data(mvydata)

  # \donttest{
  # Fit joint model with two biomarkers
  fit <- mvjmcs(ydata = mvydata, cdata = mvcdata, 
                long.formula = list(Y1 ~ X11 + X12 + time, 
                                    Y2 ~ X11 + X12 + time),
                random = list(~ time | ID,
                              ~ 1 | ID),
                surv.formula = Surv(survtime, cmprsk) ~ X21 + X22)
  fit
  # Extract the parameter estimates of longitudinal sub-model fixed effects
  fixef(fit, process = "Longitudinal")
  # Extract the parameter estimates of survival sub-model fixed effects
  fixef(fit, process = "Event")
  # Obtain the random effects estimates for first 6 subjects 
  head(ranef(fit))
  
  set.seed(08252025)
  sampleID <- sample(mvcdata$ID, 2, replace = FALSE)
  subcdata <- mvcdata %>%
    dplyr::filter(ID %in% sampleID)
  subydata <- mvydata %>%
    dplyr::filter(ID %in% sampleID)
# Make predictions at the horizon times
  survfit.mv <- survfitJM(fit, seed = 100, ynewdata = subydata, cnewdata = subcdata,
                          u = c(7, 8, 9), obs.time = "time")
  survfit.mv
  # }
  

Run the code above in your browser using DataLab