Random Forests for Time-Fixed and Time-Dependent Predictors: The DynForest R Package
The R package DynForest implements random forests for predicting a continuous, a categorical, or a (multiple causes) time-to-event outcome based on time-fixed and time-dependent predictors. The main originality of DynForest is that it handles time-dependent predictors that can be endogenous (i.e., impacted by the outcome process), measured with error, and measured at subject-specific times. At each recursive step of the tree building process, the time-dependent predictors are internally summarized into individual features on which the split can be done. This is achieved using flexible linear mixed models (thanks to the R package lcmm), whose specification is pre-specified by the user. DynForest returns the mean for a continuous outcome, the category with a majority vote for a categorical outcome, or the cumulative incidence function over time for a survival outcome. DynForest also computes variable importance and minimal depth to inform on the most predictive variables or groups of variables. This paper aims to guide the user with step-by-step examples for fitting random forests using DynForest.
Institutions
- Université de Bordeaux (FR)
- Inserm (FR)
- Bordeaux Population Health (FR)
Publication Details
- Journal
- The R Journal
- Published
- 2025-08-07
- DOI
- https://doi.org/10.32614/rj-2025-002
- Citations
- 1
- Primary Topic
- Data Analysis with R
- Type
- article
- Field-Weighted Citation Impact
- 2.48
Funders
- Agence Nationale de la Recherche