美文网首页R画图R for statisticsData science
【R>>survivalROC】ROC最佳cutoff

【R>>survivalROC】ROC最佳cutoff

作者: 高大石头 | 来源:发表于2021-05-24 09:45 被阅读0次

KM(Kaplan-Meier)需要分组变量是二分类的,如果是基因表达量或者riskScore时,则需要转化为二分类。当然这个转化是有技巧可言的,比如下面这篇文章:


PMID: 33954109

选择的分割点是ROC最靠左上角的点。在文中作者的描述:

An optimal cut-off was determined based on the ROC analysis (Figure 2B). As shown in Figure 2B, we selected the point with the maximal sensitivity and specificity as the cut-off point (value = 1.349) and the patients in training set were divided into two groups, high risk group (n = 130) and low risk group (n = 278) (Figure 2A).

图形复现

rm(list = ls())
library(tidyverse)
library(survivalROC)
risk <- data.table::fread("temp_data/riskTrain.txt",data.table = F) %>% 
  column_to_rownames("id")
predict_time1=3
predict_time2=5

auc_text=c()
you_roc <- survivalROC(Stime=risk$futime,
                       status = risk$fustat,
                       marker = risk$riskScore,
                       predict.time = predict_time1,
                       method = "KM")

cutoff_3years <- you_roc$cut.values[which.max(you_roc$TP-you_roc$FP)]
cutoff_3years
y1 <- you_roc$TP[you_roc$cut.values==cutoff_3years]
x1 <- you_roc$FP[you_roc$cut.values==cutoff_3years]

plot(you_roc$FP,you_roc$TP,
     xlim=c(0,1),ylim=c(0,1),
     col="firebrick3",
     xlab="False positive rate", 
     ylab="True positive rate",
     lwd = 2, cex.main=1.5, cex.lab=1.3, cex.axis=1.3, font=1.3)
title (paste0("ROC curve"," (AUC=",sprintf("%.3f",you_roc$AUC),")"),
       font.main=1)
abline(0,1)
arrows(x0=0.3,y0=0.9,x1=x1,y1=y1,length = 0.2,angle = 10,code = 2,col = "royalblue")
text(0.3,0.92,
     labels = paste("Cutoff value: ",round(cutoff_3years,3)))

是不是看着有点神似了。

参考链接:
利用ROC曲线寻找最佳cutoff值(连续型变量组成的riskscore)

相关文章

  • 【R>>survivalROC】ROC最佳cutoff

    KM(Kaplan-Meier)需要分组变量是二分类的,如果是基因表达量或者riskScore时,则需要转化为二分...

  • R语言survivalROC代码初步版

    library(survivalROC) data=read.csv("age cutoff.csv") nobs...

  • pROC包学习

    ROC曲线 > 我们在做诊断性实验的时候,最常用的选择最佳cutoff的方法是使用ROC曲线。本次主要介绍的是pR...

  • R包学习-pROC

    ROC曲线 我们在做诊断性实验的时候,最常用的选择最佳cutoff的方法是使用ROC曲线。本次主要介绍的是pROC...

  • 生存分析至尊套餐

    不同的cutoff 划分随机森林生存分析ROC阈值生存分析outlier 去除

  • ROC曲线

    ①ROC曲线及根据cutoff值分组 输入文件为经多因素cox分析后得到的风险值文件 ②多指标ROC曲线

  • R语言ROC曲线绘制01-survivalROC

    作者:白介素2 相关阅读:R语言生存分析04-Cox比例风险模型诊断R语言生存分析03-Cox比例风险模型R语言生...

  • ROC曲线绘制-plotROC和survivalROC

    ROC曲线 ROC曲线是反应一个分类器在某个阈值时对样本的识别能力。 可以借助ROC曲线选择出某一诊断方法最佳的诊...

  • plot.roc 显示任意cutoff

  • KM生存分析如何取最佳的cutoff

    KM生存分析 如何取最佳cutoff KM生存分析中通常取中位值作为cutoff,但也并不一定是这样 必要时可以选...

网友评论

    本文标题:【R>>survivalROC】ROC最佳cutoff

    本文链接:https://www.haomeiwen.com/subject/klctsltx.html