This function implements multiple imputation for a joint model that handles time-dependent covariates with missing variables. It applies a Cox or Aalen model to the imputed data, combining results from multiple imputations using Rubin's rule.

jmMI(
  ldata,
  sdata,
  M = 5,
  id,
  visitTime,
  timeDep,
  impModel = NULL,
  coxModel = NULL,
  model = "Cox"
)

Arguments

ldata

A data frame containing the longitudinal data. This should include variables for subject ID, time, and biomarkers.

sdata

A data frame containing the survival data. This should include variables for the subject ID, survival time, and event indicator.

M

The number of imputations to perform. Default is 5.

id

A character string specifying the variable in `ldata` and `sdata` representing the subject ID.

visitTime

A character string specifying the variable in `ldata` representing the visit times.

timeDep

A character vector specifying the time-dependent covariates in the longitudinal data (`ldata`).

impModel

A list of models for imputation of the time-dependent covariates. Each model should be a formula.

coxModel

A formula specifying the Cox model for the survival data.

model

A character string specifying the model to use for the survival analysis. Options are "Cox" (default) or "Aalen".

Value

A list containing the following components:

res

A summary of the results from the multiple imputation procedure.

coefs

A matrix of the estimated coefficients from the survival model for each imputation.

vars

A matrix of the variances of the estimated coefficients for each imputation.

nam

A character vector of the names of the variables in the survival model.

fitted_model

A list of the fitted survival models for each imputation.

imp.data

A list of the imputed data sets.

miss.data

The missing values in the time-dependent covariates.

complete_data

A list of the complete imputed data sets.

tname

The name of the survival time variable.

ename

The name of the event indicator variable.

method

A character string indicating the method used ("MI").

Details

This function is designed to handle joint modeling for longitudinal and survival data with time-dependent covariates. It allows for the imputation of missing data in the time-dependent covariates using the provided imputation models. The function can then apply a Cox or Aalen model to the imputed data and return the results.

References

Goodrich, B., et al. "rstanarm: Bayesian applied regression modeling via Stan. R package version 2.17. 4." Online< http://mc-stan. org (2018).

Bhattacharjee, A., Rajbongshi, B. K., & Vishwakarma, G. K. (2024). jmBIG: enhancing dynamic risk prediction and personalized medicine through joint modeling of longitudinal and survival data in big routinely collected data. BMC Medical Research Methodology, 24(1), 172.

Author

Atanu Bhattacharjee, Bhrigu Kumar Rajbongshi and Gajendra Kumar Vishwakarma

Examples

library(survival)
model_jmMI <- jmMI(ldata=long_data,sdata=surv_data,
              timeDep=c("marker_1","marker_2","marker_3"),
              impModel=list(marker_1~Z_1+Z_2+Time+(1|ID),
                           marker_2~Z_1+Z_2+Time+(1|ID),
                           marker_3~Z_1+Z_2+Time+(1|ID)),
              visitTime="Time",
              coxModel=Surv(survival_time,survival_status)~Z_1+Z_2+
              td(marker_1)+td(marker_2)+td(marker_3),
              model="Cox",
              id="ID")
model_jmMI
#> Fitting two stage joint model :
#> Method:  MI 
#> Time variable:  survival_time 
#> Event variable:  survival_status 
#> 
#> Fitted model summary:
#>           logHR    SE  CIlow CIupp p-value
#> marker_1 -0.151 0.092 -0.332 0.030   0.103
#> marker_2 -0.058 0.100 -0.253 0.138   0.563
#> marker_3  0.041 0.090 -0.136 0.218   0.649
#> Z_1       0.413 0.233 -0.043 0.869   0.076
#> Z_2       0.125 0.346 -0.554 0.804   0.719