R语言survivalROC代码初步版
2020-10-28 本文已影响0人
灵活胖子的进步之路
library(survivalROC)
data=read.csv("age cutoff.csv")
nobs=NROW(data) #定义数据集的行数
cutoff=1825 #设定为5年生存时间(可根据需要修改)
#生存日期转换为days
delete"NA" 去掉缺失数据
data=data[which(data$Status!="NA"),]
Fit survival ROC model with method of "KM"
SROC=survivalROC(Stime=data$TIME,
status=data$DEAD,
marker=data$AGE,
predict.time=cutoff,
method="KM")
cut.op=SROCTP-SROC$FP)]
cut.op
plot survival ROC
plot(SROCTP,type="l",xlim=c(0,1),ylim=c(0,1),
xlab=paste("FP","\n","AUC=",round(SROC$AUC,3)),
ylab="TP",main="5-year survival ROC",col="red")
abline(0,1)
legend("bottomright",c("AGE"),col="red",lty=c(1,1))