建议使用R包里的pROC,例子如下:
fit <- survivalROC(Stime = time, status = status, marker = riskScore, predict.time = 10, method = "KM")
optimalCutoff <- fit$cut.values[which.max(fit$TP - fit$FP)]
ROC.1<-fit
plot(ROC.1$FP,ROC.1$TP,type='l',xlim=c(0,1),ylim=c(0,1)
,xlab='FP',ylab='TP',main='ROC',col='blue')
abline(0,1)