首页 > 解决方案 > 在 R 上使用 pROC 的 ROC 曲线:计算阈值等于的实验室值

问题描述

我正在使用 pROC 提供血液测试的 ROC 分析。我已经计算了 ROC 曲线、AUC,并正在使用 ci.coords 函数以提供的特异性(95% CI)提供规格、传感器、PPV 和 NPV。

我想能够说出这是什么值的血检,例如在 1.2 时,sens 是 x,spec 是 y,NPV 是 c,PPV 是 d。理想情况下,我应该有如下表的数据:

Lab value | Sens | Spec | NPV | PPV

我似乎无法从我目前使用的方法中得到这个?

有没有人有什么建议?

非常感谢

目前


spred1 = predict(smodel1)

sroc1 = roc(EditedDF1$any_abnormality, spred1)

ci.coords(sroc1, x=0.95,  input="sensitivity", transpose = FALSE, ret=c("sensitivity","specificity","ppv","npv"))```

标签: rstatisticsrocproc-r-package

解决方案


由于您没有给出可重复的示例,因此我们使用包装随附的示例

library(pROC)
data(aSAH)
roc1 <- roc(aSAH$outcome, aSAH$s100b)

该软件包附带coords列出不同阈值的特异性和敏感性的功能:

> coords(roc1)
   threshold specificity sensitivity
1       -Inf  0.00000000  1.00000000
2      0.035  0.00000000  0.97560976
3      0.045  0.06944444  0.97560976
4      0.055  0.11111111  0.97560976
5      0.065  0.13888889  0.97560976
6      0.075  0.22222222  0.90243902
7      0.085  0.30555556  0.87804878
8      0.095  0.38888889  0.82926829
9      0.105  0.48611111  0.78048780
10     0.115  0.54166667  0.75609756
...

从那里,您可以使用ci.coords您已经使用的功能,通过您想要的任何数据来完成表格。


推荐阅读