1

我试图从ranger预测中获得预期的死亡时间。给定下面的代码,我如何从 中的生存概率估计死亡时间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)
4

0 回答 0