I want to find the survival rate at 5 years. #397
Replies: 2 comments
-
The rows represent the data points, so row i is the estimated survival for patient i. The columns are the estimated survival for the time points Therefore in your code, change to the following:
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much for your reply. One more thing I'm curious about... Speaking of 5 years, I wonder why rf_model$time.interest/365<=5 And in the past, Even in this code, id <- max(which(temp$time <= t), I found the smaller point in time... I wonder if I shouldn't find the smallest point in time after 5 years. In summary, I'm curious to find the part that is less than or equal to <=5. This seems to be correct... but I'm wondering if min(>=5) doesn't work like this. I am curious as to whether the timing of not exceeding 5 years is more accurate than the timing of exceeding 5 years. I wonder if it's because if you find the smallest point over 5 years, it could be 6 or 7 years. Could it be that it would be more accurate to find a point less than 5 years than to go beyond that period? So it could be 4 years... Is that more accurate than overdue in medical statistics? |
Beta Was this translation helpful? Give feedback.
-
library(randomForestSRC)
na.omit(pbc)
data(pbc, package = "randomForestSRC")
pbc<-na.omit(pbc)
set.seed(42)
n <- nrow(pbc)
n_train <- 200
train_data <- pbc[1:n_train, ]
test_data <- pbc[-(1:n_train), ]
rf_model <- rfsrc(Surv(days, status) ~ ., data = train_data)
predictions <- predict(rf_model, test_data)
predictions$survival
In this part, there are 104 columns, but I don't understand why a matrix appears, and I want to know what the columns mean. I want to find the survival rate at 5 years and draw a roc curve with the survival rate and status. If you know how, please let me know.
For example, it doesn't seem to be selecting column 5. But I chose it and drew it.
predicted_survival_5_years <- as.vector(predictions$survival[, 5])
library(pROC)
roc_obj <- roc(test_data$status, predicted_survival_5_years)
plot(roc_obj, main = "ROC Curve for Survival at 5 Years")
Beta Was this translation helpful? Give feedback.
All reactions