I have ~100 variables on a spreadsheet that I would need to determine the best ROC cutoff and the AUC for 2-year OS, using the survivalROC package. To clarify, I need to determine the best ROC cutoff/AUC for each variable individually.
I'm using the code below to run ROC for one variable, but I'm not sure how to use a loop or something similar to run this for all 100 variables without copying and pasting the code 100x. Would anyone be able to help me? Thank you so much!
ROC.cutoff24<-survivalROC(Stime=data$Time_OS,
status=data$OS,
marker=-data$Variable_1,
predict.time=24,
method = 'KM')
ROC.cutoff24$cut.values[which.max(ROC.cutoff24$TP-ROC.cutoff24$FP)]
ROC.cutoff24[["AUC"]]