使用ROCit绘制多条ROC曲线

使用ROCit绘制多条ROC曲线,r,R,我想用ROCit来创建ROC曲线。但我不知道,如何在同一个图中绘制两条ROC曲线 例如: data("Diabetes") library(ROCit) plot(rocit(score = Diabetes$chol, class = Diabetes$dtest, negref = "-")) par(new=TRUE) plot(rocit(score = Diabetes$bmi, class = Diabetes$dtest, negref = "-")) 在两者之间使用par命令,

我想用ROCit来创建ROC曲线。但我不知道,如何在同一个图中绘制两条ROC曲线

例如:

data("Diabetes")
library(ROCit)
plot(rocit(score = Diabetes$chol, class = Diabetes$dtest, negref = "-"))
par(new=TRUE)
plot(rocit(score = Diabetes$bmi, class = Diabetes$dtest, negref = "-"))
在两者之间使用
par
命令,我可以让它工作,但我必须手动设置所有颜色,而且图例也不能正确反映数据


是否可以使用ROCit在同一绘图中比较不同的模型?

绘制第一个ROCit对象,然后为后续对象添加线条

请注意,后面的部分被指定为$TPR~$FPR(出于某种原因)

数据(糖尿病)
图书馆(ROCit)
#罗吉特物体

我现在明白了。还可以为两条曲线绘制Youden索引吗?除非将两个曲线都生成为png图像,然后在imagemagick中混合它们。这不仅是一个黑客行为,也不能解决传奇问题。
data(Diabetes)
library(ROCit)

# ROCit objects
roc_emp1 <- rocit(score = Diabetes$chol, class = Diabetes$dtest, negref = "-") 
roc_emp2 <- rocit(score = Diabetes$bmi, class = Diabetes$dtest, negref = "-") 

# plot the first, then the second, then add the legend
plot(roc_emp1, col = c(1,"gray50"), 
     legend = FALSE, YIndex = FALSE)
lines(roc_emp2$TPR ~ roc_emp2$FPR, 
      col = 2, lwd = 2)
legend("bottomright", col = c(1,2),
       c("Empirical ROC 1", "Empirical ROC 2"), lwd = 2)