Package: BJM 0.3.0

Wenhao Li

BJM: Backward Joint Model for the Dynamic Prediction of Both Time-to-Event and Longitudinal Outcomes

Provides tools to fit joint models of multivariate longitudinal data and time-to-event data for dynamic prediction. It allows the joint prediction of both future time-to-event outcomes and future longitudinal outcomes conditional on survival. The models accommodate irregularly measured longitudinal data and competing risks outcomes. The use of the backward joint model enables fast and efficient computation, especially for applications with large sample sizes and many longitudinal variables. Methods without competing risks are described in Shen and Li (2021) <doi:10.1002/sim.9037>, and their extension to competing risks is described in Li et al. (2026) <doi:10.1007/s10985-026-09725-x>.

Authors:Wenhao Li [aut, cre], Liang Li [aut]

BJM_0.3.0.tar.gz
BJM_0.3.0.zip(r-4.7-any)BJM_0.3.0.zip(r-4.6-any)
BJM_0.3.0.tar.gz(r-4.7-any)BJM_0.3.0.tar.gz(r-4.6-any)
BJM_0.3.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
BJM/json (API)

# Install 'BJM' in R:
install.packages('BJM', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/wenhaoli18/bjm/issues

Pkgdown/docs site:https://wenhaoli18.github.io

Datasets:
  • pbc3 - Mayo Clinic primary biliary cirrhosis data used as example code

On CRAN:

Conda:

3.48 score 433 downloads 19 exports 22 dependencies

Last updated from:0fc5e1fa7e. Checks:6 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-develOK296
source / vignettesOK249
linux-releaseOK367
windows-develOK346
windows-releaseOK353
wasm-releaseOK140

Exports:buildRecurrentEpisodescalibrationPlotcheckBandcountConvergencecifPlotcmtPlotfitIntervalBJMimputeLongitudinallongitudinalSubperformancePlotpoolLongitudinalSubpredictLongitudinalpredictPlotpredictRecurrentCountpredictRiskriskPlotsimulateTrajectoryspaghettiPlotsurvivalSubsurvivalTrans

Dependencies:clicpp11farverggplot2gluegtableisobandlabelinglatticelifecycleMatrixmvtnormnlmeR6RColorBrewerrlangS7scalessurvivalvctrsviridisLitewithr

Getting started with BJM
Overview | Step 1: Fit the survival sub-model with survivalSub() | Step 2: Fit the longitudinal sub-models with longitudinalSub() | Missing biomarker values | Step 3: Predict event risk with predictRisk() | Step 4: Predict a future biomarker value with predictLongitudinal() | Choosing bandcount1, bandcount2, bandcount3 | Friendly error messages | Where to go next

Last update: 2026-10-31
Started: 2026-09-25

Nonlinear terms in longitudinal formulas
Overview | Terms that are always safe | Explicit polynomials and transforms | Interactions | Terms that are safe only in a continuous biomarker's long_sub_fixed | Orthogonal poly(), splines, and factor() | What goes wrong elsewhere | Precomputed time transforms with survivalTrans() | Putting it together: a spline term through to prediction

Last update: 2026-10-31
Started: 2026-10-31

Readme and manuals

Help Manual

Help pageTopics
Reshape recurrent-event data into gap-time episodes for the backward joint modelbuildRecurrentEpisodes
Plot calibration of dynamic risk predictionscalibrationPlot
Check whether bandcount1/bandcount2/bandcount3 are large enoughcheckBandcountConvergence
Plot cumulative incidence functionscifPlot
Plot conditional mean trajectories (CMT)cmtPlot
Fit the backward joint model to interval-censored event timesfitIntervalBJM
Impute missing longitudinal biomarker valuesimputeLongitudinal
Fit a multivariate longitudinal sub-modellongitudinalSub
Mayo Clinic primary biliary cirrhosis data used as example codepbc3
Plot predictive performance across landmark timesperformancePlot
Plot a fitted longitudinal sub-modelplot.longitudinalSub.BJM
Plot predicted biomarker distributionsplot.predictLongitudinal.BJM
Plot simulated futuresplot.simulateTrajectory.BJM
Plot a fitted survival sub-modelplot.survivalSub.BJM
Pool longitudinal sub-model fits across multiple imputations with Rubin's rulespoolLongitudinalSub
Dynamic prediction function for future longitudinal outcomespredictLongitudinal
Plot risk and future biomarker predictions across a horizon sweeppredictPlot
Predict the number of recurrent events in a window, by rolling episodes forwardpredictRecurrentCount
Dynamic prediction function for future event riskpredictRisk
Plot predicted risk across a sweep of landmark timesriskPlot
Simulate future trajectories from the backward joint modelsimulateTrajectory
Plot individual longitudinal trajectories (spaghetti plot)spaghettiPlot
Fit the survival sub-modelsurvivalSub
Build a survival-time transform basis from cut pointssurvivalTrans