看教程不够直观,那就看视频吧! >>点击加载视频
效果图如:
library(timeROC)
library(survival)
ROC.DSST=timeROC(T=time,
delta=status
,marker=test.score,
cause=1,weighting="marginal",
times=c(12,12*3,12*5,12*10),
iid=TRUE)
plot(c(0,1),c(0,1),type='l',xlab='False positive rate',ylab='Ture positive rate')
for(i in 1:length(ROC.DSST$times)){
los=lowess(ROC.DSST$FP[,i], y=ROC.DSST$TP[,i], f = 1/3, iter = 100)
los$x=c(0,los$x,1)
los$y=c(0,los$y,1)
lines(los,col=rainbow(length(ROC.DSST$times))[i],lwd = 2)
}
if(max(ROC.DSST$times)<20){
lb='Years'
}else if(max(ROC.DSST$times)<365){
lb='months'
}else{
lb='days'
}
legend('bottomright',paste0(ROC.DSST$times
,'-',lb
,' '
#,' AUC='
,round(ROC.DSST$AUC,2)
,' '
,paste0(round(confint(ROC.DSST,level = 0.9)$CI_AUC[,1],2),'-',
round(confint(ROC.DSST,level = 0.9)$CI_AUC[,2],2))
)
,col = rainbow(length(ROC.DSST$times))
,lty = rep(1,length(ROC.DSST$times)),lwd=rep(1,length(ROC.DSST$times))
,merge = TRUE,cex = 0.8
,title = paste0(paste0(rep(' ',ceiling(strwidth(paste0(ROC.DSST$times[1]
,'-',lb
,' '))/strwidth(' '))),collapse = ''),'AUC 95%CI'))
进一步获取p值的函数为:compare
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!