Source-linked AI summary
The R Package JMbayes for Fitting Joint Models for Longitudinal and Time-to-Event Data using MCMC
Dimitris Rizopoulos
TL;DR
Joint models are needed to relate longitudinal measurements to event risks, particularly when covariates are endogenous or follow-up is irregular. The paper presents JMbayes, a Bayesian MCMC package supporting flexible joint models, dynamic prediction, and validation. In the example, both current longitudinal level and slope were strongly associated with event risk, with a 50% yearly bilirubin increase corresponding to a hazard ratio of 2.9.
Problem
Joint modeling is needed to associate longitudinal responses with event times when endogenous time-varying covariates and irregular follow-up challenge standard approaches.
Method
JMbayes fits Bayesian joint models with MCMC, flexible association structures, dynamic predictions, Bayesian model averaging, and discrimination and calibration tools.
Results
Hazard ratio 2.9 (95% CI: 1.8; 4.5) corresponded to a 50% increase in serum bilirubin within a year, conditional on the same treatment, baseline age, and underlying level.
Takeaways & Limitations
JMbayes supports individualized longitudinal and survival prediction while allowing uncertainty across alternative association structures to be incorporated through Bayesian model averaging.
Takeaways & Limitations
Discrimination depends on the length of the medically relevant prediction interval, so different models may perform differently across intervals.
Abstract
from arXiv · showhide
Joint models for longitudinal and time-to-event data constitute an attractive modeling framework that has received a lot of interest in the recent years. This paper presents the capabilities of the R package JMbayes for fitting these models under a Bayesian approach using Markon chain Monte Carlo algorithms. JMbayes can fit a wide range of joint models, including among others joint models for continuous and categorical longitudinal responses, and provides several options for modeling the association structure between the two outcomes. In addition, this package can be used to derive dynamic predictions for both outcomes, and offers several tools to validate these predictions in terms of discrimination and calibration. All these features are illustrated using a real data example on patients with primary biliary cirrhosis.
1. Introduction
Joint models link longitudinal measurements with time-to-event outcomes, addressing challenges from endogenous covariates and irregular follow-up. JMbayes extends available software with Bayesian fitting, flexible outcome and association structures, dynamic prediction, and prediction validation.
- Joint models associate a longitudinal response with an event-time outcome in follow-up studies.
- They are especially useful when event hazards depend on endogenous time-varying covariates such as patient biomarkers, for which standard time-dependent Cox models are not optimal.
- Irregular visits and dropout complicate standard joint-model frameworks built around fixed measurement schedules.
- JMbayes fits Bayesian joint models for continuous and categorical longitudinal responses and supports multiple association structures between outcomes.
- The package derives dynamic predictions for both outcomes, supports Bayesian model averaging, and provides tools for assessing discrimination and calibration.
2. Theoretical framework
The theoretical framework combines generalized linear mixed-effects modeling for longitudinal responses with a survival model linked through the underlying longitudinal process. Bayesian estimation uses MCMC, flexible B-spline baseline hazards, and conditional-independence assumptions given random effects.
- Observed event data comprise the minimum of true event and censoring times, an event indicator, and repeated longitudinal responses.
- A generalized linear mixed-effects model accommodates different longitudinal response types through an exponential-family conditional distribution and subject-specific random effects.
- The survival risk depends on baseline covariates and a function of the longitudinal history, with association parameters linking marker features to event hazard.
- The logarithm of the baseline hazard is modeled with B-spline basis functions, whose number and placement control flexibility and over-fitting risk.
- Bayesian parameter estimation uses MCMC under conditional independence of the longitudinal and event processes given random effects.
- The survival function requires numerical integration because its defining integral lacks a closed-form solution.
- Diffuse priors are assigned to regression, spline, and association parameters, with additional priors for smoothing, random-effects covariance, and error variance.
3. The R package JMbayes
JMbayes builds on separately fitted mixed-effects and survival models to estimate joint models with MCMC. Its implementation supports flexible sampling options and provides a one-long-chain workflow with user-managed alternatives for convergence assessment.
- The jointModelBayes() function accepts mixed-effects and Cox-model objects plus the name of the shared time variable.
- By default, the package fits a continuous longitudinal model linked to survival through the subject-specific longitudinal predictor.
- MCMCfit() samples posterior conditionals for model parameters and random effects, using random-walk Metropolis for most parameters and specialized samplers for selected components.
- The implementation leverages the separately fitted mixed-effects and Cox models when defining the covariance structure for posterior sampling.
- JMbayes uses one long MCMC chain by default, while multiple-chain convergence checks require different initial values and additional programming.
4. Practical use of JMbayes
JMbayes is demonstrated on primary biliary cirrhosis data by fitting basic and extended Bayesian joint models, including flexible longitudinal distributions and association structures. The examples also show model summaries and package support for extracting statistics.
- 4.1. The basic joint model: The PBC analysis includes 312 randomized patients, 1945 longitudinal observations, and 169 composite events.Patients received D-penicillamine or placebo, with serum bilirubin used as the longitudinal biomarker.
- 4.1. The basic joint model: JMbayes fits a basic joint model by combining a linear mixed-effects model with a Cox survival model.The longitudinal model uses natural cubic splines for nonlinear log serum bilirubin trajectories, while the survival model controls for treatment, age, and their interaction.
- 4.1. The basic joint model: The Bayesian fit uses MCMC and reports posterior summaries, credibility intervals, tail probabilities, LPML, DIC, and effective parameter counts.The example specifies 30000 MCMC iterations after adaptation and burn-in, with thinning by 15.
- 4.2. Extended joint models: JMbayes supports continuous and categorical longitudinal outcomes through user-specified density functions.The examples include a generalized Student’s t longitudinal model and a binary outcome created by dichotomizing serum bilirubin at 1.8 mg/dL.
- 4.3. Association structures: Alternative association structures relate event risk to the current level, slope, area under the trajectory, baseline level, and longitudinal evolution.A 50% annual bilirubin increase corresponds to a hazard ratio of 2.9, while a unit increase in the area under the profile corresponds to a 1.3-fold risk increase.
- 4.4. Transformation functions: Transformation functions can model nonlinear associations, with weak evidence for nonlinearity in η_i(t) and no apparent hazard difference between treatment groups.The package also provides supporting functions and S3 methods for extracting or calculating statistics from fitted JMbayes objects.
5. Dynamic predictions
JMbayes derives subject-specific, time-updatable predictions for survival and longitudinal outcomes from joint models, and provides tools to assess their discrimination and calibration. The examples show strong discrimination for serum bilirubin in the PBC dataset, with slight over-optimism in prediction error after cross-validation.
- 5.1. Definitions and estimation: Conditional predictions estimate future survival and longitudinal responses given a subject’s measurements and survival up to time t.These quantities are based on posterior predictive distributions and can be updated when new longitudinal information arrives.
- 5.1. Definitions and estimation: JMbayes calculates subject-specific survival and longitudinal predictions with survfitJM() and predict(), including confidence intervals and alternative Monte Carlo summaries.The default survival prediction uses 200 Monte Carlo samples and assumes the patient was event-free through the last longitudinal measurement unless specified otherwise.
- 5.2. Bayesian model averaging: Bayesian model averaging combines model-specific predictions using posterior weights that vary by subject and time, allowing risk assessments to reflect the models most probable for each observed trajectory.The new subject informs the weights through longitudinal measurements and survival history but does not contribute to refitting model parameters.
- 5.3. Predictive accuracy: Dynamic validation evaluates discrimination and calibration, including time-window sensitivity, specificity, AUC, and dynamic concordance measures.The discrimination rule classifies subjects using conditional survival probability over a medically relevant interval in which clinical action may be possible.
- 5.3. Predictive accuracy: 0.842 AUC was estimated at time 7 using information through time 5, while dynamic concordance was 0.8496 over a two-year interval.The authors report that serum bilirubin discriminated well between patients expected to die within two years and remained useful across follow-up.
- 5.3. Predictive accuracy: Cross-validation reproduced the original AUC estimate but showed slight over-optimism in prediction error.This comparison distinguishes stable discrimination from a less well-calibrated prediction-error estimate in the validation analysis.
6. Future plans
JMbayes is presented with several currently available joint-modeling capabilities, while additional extensions are planned to broaden longitudinal outcomes, covariates, survival outcomes, and dynamic predictions.
- The current JMbayes version fits joint models for longitudinal and time-to-event data under a Bayesian approach.
- Planned extensions include multiple longitudinal outcomes with the association structures presented in the paper.
- The package is planned to accommodate exogenous time-varying covariates through a time-dependent Cox model.
- Future survival-submodel extensions include competing risks, recurrent events, and left- and interval-censored event times.
- Dynamic predictions are planned to support these survival-submodel extensions.
A. MCMC diagnostic plots
JMbayes provides diagnostic plotting methods for fitted joint models, including traceplots and kernel density estimates for longitudinal-submodel parameters.
- The plot() method produces MCMC diagnostic plots, including trace, autocorrelation, and kernel density estimated plots.
- The plotting interface can also create the figure of the conditional predictive ordinate.
- Traceplots can be generated for the betas, sigma, and D parameters of the longitudinal submodel.
- Kernel density estimation plots visualize the parameters of the longitudinal submodel from jointFit.pbc1.