We are interested in replicating several duration studies in the literature using ensemble learning methods. After some experimentation, we opted for random survival forests (Ishwaran et al. 2008) for their simplicity and performance. However, the package randomForestSRC
in R only allows for time-invariant covariates. As one might guess, many interesting theoretical problems usually involve parameters that take on different values over time. Does anyone know how to implement TVCs in R using machine learning? We would prefer sticking to random forests, but naturally would switch if there is a better alternative.
Asked
Active
Viewed 424 times
7
1 Answers
4
The most widely used approach for survival analysis of time-varying covariates (TVCs) are Cox models. There you need to create a dataset with TVCs which is described in this vignette
fit.cox <- coxph(Surv(time1, time2, event) ~ x), data = data)
However there is also the possibility to include TVCs in random survival forests. This paper by Wongvibulsin, Wu, and Zeger (2019) extends the randomForestSRC package to handle TVC, but you may need to contact the authors for any relevant code.

Rootless17b
- 328
- 1
- 8
-
There appears to be an implementation of RF-SLAM (algorithm described in Wongvibulsin, Wu, and Zeger 2019) here: https://github.com/mattrosen/rfSLAM – matmat Sep 23 '21 at 23:15
-
See also: https://cran.r-project.org/web/packages/LTRCforests/ – matmat Sep 23 '21 at 23:19