coherent4cast: Coherent Survival Modelling and Forecasting for History-Dependent Recurrent and Terminal Events in R
Abstract
Researchers studying recurrent events and terminal outcomes need software that connects incomplete event histories to interpretable forecasts and uncertainty estimates. We present coherent4cast, an R package for fitting history-dependent recurrent and terminal event models, predicting future event burden and terminal-event risk, and assessing sensitivity to incomplete observation. Users supply event histories, covariates and observation information; the package returns fitted models, dynamic forecasts, uncertainty summaries and diagnostic measures under explicitly stated assumptions.
The package integrates over event histories compatible with tied dates or observation windows and supports several frailty distributions for between-subject heterogeneity. A shared probability model generates recurrent-event counts, terminal-event probabilities and restricted mean time alive. Cross-fitted targeting provides influence-function diagnostics and asymptotic inference in supported missing-at-random and right-censoring settings. Separate sensitivity analyses provide bounds under specified recording restrictions. A baseline binary-treatment interface estimates standardized treatment contrasts under consistency, conditional exchangeability, positivity and independent censoring.
A C++17 computational core supports the R interface. Independent numerical checks, computational benchmarks, simulation experiments and reproducible examples document accuracy, performance and inferential limitations. Outputs retain observation assumptions, convergence information and numerical diagnostics. The package, tutorials and replication materials are publicly available, supporting transparent analysis across clinical and other event-history applications.