1

I am trying to obtain the expected time to death from ranger predictions. Given the code below, how do I estimate the time to death from the survival probability in predictions$survival?

library(survival)
library(ranger)


data <- pbc
data <- data[complete.cases(data), ]

sample_size <- floor(0.8 * nrow(data))
train_index <- sample(seq_len(nrow(data)), size = sample_size)
data_train <- data[train_index, ]
data_test <- data[-train_index, ]

ranger_model <- ranger(Surv(data_train$time, data_train$status==2) ~., data=data_train, importance = "permutation", write.forest = TRUE)

predictions <- predict(ranger_model, data_test)
jay.sf
  • 60,139
  • 8
  • 53
  • 110
Luca_brasi
  • 89
  • 7

0 Answers0