install.packages("ggplot2")安装ggplot2包library(pROC) #调用pROC包library(ggplot2) #安装ggplot包 data(aSAH)# 引入案例数据View(aSAH) #展示案例数据 r..._plot(roca">

画ROC曲线

R软件:如何画ROC曲线

> install.packages("pROC")   安装pROC包

> install.packages("ggplot2")安装ggplot2包

library(pROC) #调用pROC包

library(ggplot2)  #安装ggplot包

 data(aSAH)# 引入案例数据

View(aSAH) #展示案例数据

 

roca<-roc(aSAH$outcome,aSAH$s100b)
rocb<-roc(aSAH$outcome,aSAH$wfns)
rocc<-roc(aSAH$outcome,aSAH$ndka)
auc(roca)
auc(rocb)
auc(rocc)

> auc(roca)
Area under the curve: 0.7314
> auc(rocb)
Area under the curve: 0.8237
> auc(rocc)
Area under the curve: 0.612

 plot(roca)

 

plot(rocb)

#ROC曲线下面积的比较
roc.test(roca,rocb,method = "delong") 

        DeLong's test for two correlated ROC curves

data:  roca and rocb
Z = -2.209, p-value = 0.02718
alternative hypothesis: true difference in AUC is not equal to 0
sample estimates:
AUC of roc1 AUC of roc2 
  0.7313686   0.8236789 

g3<-ggroc(list(s100b=roca,wfns=rocb,ndka=rocc))
g3

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值