为什么通过pROC Package的不同功能计算出的95%CI值不同?

dbcoffee

我正在使用pROC软件包来计算特异性值和“最佳”阈值的95%CI,我的程序代码如下:

data(aSAH)
myroc <- roc(aSAH$outcome, aSAH$s100b)
ci.thresholds(myroc, thresholds = "best")

95% CI (2000 stratified bootstrap replicates):
 thresholds sp.low sp.median sp.high se.low se.median se.high
      0.205 0.7083    0.8056  0.8889 0.4878    0.6341  0.7805

我从函数ci.coords获得的值是:

ci.coords(myroc, x = "best", ret = c("specificity"))
95% CI (2000 stratified bootstrap replicates):
 threshold specificity.low specificity.median specificity.high
      best          0.6663             0.8194           0.9865

通过函数ci.thresholds得出的值为:

ci.thresholds(myroc)
95% CI (2000 stratified bootstrap replicates):
 thresholds  sp.low sp.median sp.high se.low se.median se.high
       -Inf 0.00000    0.0000  0.0000 1.0000    1.0000  1.0000
      0.065 0.06944    0.1389  0.2222 0.9268    0.9756  1.0000
      0.075 0.12500    0.2222  0.3194 0.8049    0.9024  0.9756
      0.085 0.19440    0.3056  0.4167 0.7805    0.8780  0.9756
      0.095 0.27780    0.3889  0.5000 0.7073    0.8293  0.9268
      0.105 0.37500    0.4861  0.5972 0.6579    0.7805  0.9024
      0.115 0.43060    0.5417  0.6528 0.6098    0.7561  0.8780
      0.135 0.47220    0.5833  0.6944 0.5366    0.6829  0.8293
      0.155 0.58330    0.6944  0.7917 0.5122    0.6585  0.8049
      0.205 0.70830    0.8056  0.8889 0.4878    0.6341  0.7805
      0.245 0.72220    0.8194  0.9028 0.4390    0.5854  0.7317
      0.290 0.75000    0.8333  0.9167 0.3659    0.5122  0.6585
      0.325 0.76390    0.8472  0.9306 0.3171    0.4634  0.6098
      0.345 0.79170    0.8750  0.9444 0.2927    0.4390  0.5854
      0.395 0.81910    0.8889  0.9583 0.2683    0.4146  0.5610
      0.435 0.83330    0.9028  0.9583 0.2439    0.3902  0.5366
      0.475 0.90280    0.9583  1.0000 0.1951    0.3415  0.4878
      0.485 0.93060    0.9722  1.0000 0.1707    0.3171  0.4634
      0.510 1.00000    1.0000  1.0000 0.1707    0.2927  0.4390

当阈值为0.205时,特异性值为0.8056(ci.thresholds(myroc,thresholds =“ best”)),但通过ci.coords(myroc,x =“ best”,ret = c(“ specificity” ))为0.8194,此时阈值为0.245。为什么通过不同功能获得的阈值不相同?

然后,ci.coords(myroc,x =“ best”,ret = c(“ specificity”))获得的特异性值为0.8194,95%CI为0.6806-0.9861,但通过ci.thresholds获得(myroc)为0.8194,95%CI:0.7222-0.9028。

更新:

> coords(myroc, x = "best", ret="all", transpose = FALSE)
          threshold specificity sensitivity  accuracy tn tp fn fp       npv  ppv  fdr       fpr       tpr       tnr
threshold     0.205   0.8055556   0.6341463 0.7433628 58 26 15 14 0.7945205 0.65 0.35 0.1944444 0.6341463 0.8055556
                fnr 1-specificity 1-sensitivity 1-accuracy     1-npv 1-ppv precision    recall   youden
threshold 0.3658537     0.1944444     0.3658537  0.2566372 0.2054795  0.35      0.65 0.6341463 1.439702
          closest.topleft
threshold       0.1716575



> ci.coords(myroc, x = "best", ret = "all", transpose = TRUE)
95% CI (2000 stratified bootstrap replicates):
     threshold threshold.low threshold.median threshold.high specificity.low specificity.median specificity.high
best      best          0.12            0.205           0.51          0.6663             0.8194                1
     sensitivity.low sensitivity.median sensitivity.high accuracy.low accuracy.median accuracy.high tn.low tn.median
best          0.3902             0.6341           0.8049       0.6637          0.7522         0.823  47.98        59
     tn.high tp.low tp.median tp.high fn.low fn.median fn.high fp.low fp.median fp.high npv.low npv.median npv.high
best      72     16        26      33      8        15      25      0        13   24.02  0.7273     0.7973   0.8732
     ppv.low ppv.median ppv.high fdr.low fdr.median fdr.high fpr.low fpr.median fpr.high tpr.low tpr.median tpr.high
best  0.5366     0.6667        1       0     0.3333   0.4634       0     0.1806   0.3337  0.3902     0.6341   0.8049
     tnr.low tnr.median tnr.high fnr.low fnr.median fnr.high 1-specificity.low 1-specificity.median 1-specificity.high
best  0.6663     0.8194        1  0.1951     0.3659   0.6098                 0               0.1806             0.3337
     1-sensitivity.low 1-sensitivity.median 1-sensitivity.high 1-accuracy.low 1-accuracy.median 1-accuracy.high
best            0.1951               0.3659             0.6098          0.177            0.2478          0.3363
     1-npv.low 1-npv.median 1-npv.high 1-ppv.low 1-ppv.median 1-ppv.high precision.low precision.median precision.high
best    0.1268       0.2027     0.2727         0       0.3333     0.4634        0.5366           0.6667              1
     recall.low recall.median recall.high youden.low youden.median youden.high closest.topleft.low
best     0.3902        0.6341      0.8049      1.279         1.447        1.61             0.08148
     closest.topleft.median closest.topleft.high
best                 0.1717               0.4021

coords和ci.coords的特异性分别为0.8055556和0.8194,上面还有其他一些不同的结果。

冷静

当你跑步

ci.coords(myroc, x = "best" [...]

您正在有效地计算最佳阈值本身的置信区间

在内部,pROC对数据进行重新采样,确定重新采样曲线上的最佳阈值是多少,计算该阈值处的坐标,然后重复2000次。这不同于将阈值设置为整个ROC曲线上的最佳点并在该给定阈值下进行重采样。

如果您关注阈值置信区间,则可以看到以下内容:

ci.coords(myroc, x = "best", ret = "all", transpose = TRUE)
95% CI (2000 stratified bootstrap replicates):
     threshold threshold.low threshold.median threshold.high [...]
best      best          0.12            0.205           0.51

看看“最佳”阈值如何在0.205(0.12和0.51之间)之间变化?结果,所有坐标也将具有更宽的置信区间。

ci.thresholds函数的行为有所不同,并使用了我上面提到的第二个选项,在整个ROC曲线上设置了“最佳”阈值:

ci.thresholds(myroc, thresholds = "best")

95% CI (2000 stratified bootstrap replicates):
 thresholds 
      0.205

看看阈值附近没有置信区间吗?在重采样之前将其设置。ci.coords如果将其设置x为数字阈值(在整个ROC曲线上恰好是最佳值,即此处为0.205)可能会得到相同的行为

> ci.coords(myroc, x = 0.205)
95% CI (2000 stratified bootstrap replicates):
      threshold threshold.low threshold.median threshold.high specificity.low specificity.median specificity.high sensitivity.low sensitivity.median sensitivity.high
0.205     0.205         0.205            0.205          0.205          0.7083             0.8056           0.8889          0.4878             0.6341           0.7805

您会看到阈值未重新采样(置信区间在0.205值附近没有变化),并且置信区间与使用所获得的相似ci.thresholds

我意识到可以在其中更好地记录下来,?ci.coords并将在将来的版本中做到这一点。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么var()函数给我的答案不同于计算出的方差?

来自分类Dev

Android:为什么计算出的可用空间与Android显示的可用空间不同

来自分类Dev

为什么sklearns分类报告中的“加权”平均F1分数与通过公式计算出的F1分数不同?

来自分类Dev

为什么Chrome开发人员工具计算出的样式与“样式”标签显示的有所不同?

来自分类Dev

在VS和gcc上计算出的不同值

来自分类Dev

选择不同的值,并计算出现次数

来自分类Dev

为什么补码通过printf表现不同?

来自分类Dev

是否可以将通过条件计算出的值插入到mysql中?

来自分类Dev

通过插入从其他列计算出的值来更新rails mass更新列

来自分类Dev

为什么Stata和R中一个样本的比例测试的95%CI不同

来自分类Dev

通过在PIG中的同一块内计算出的条件值在FOREACH块内进行过滤

来自分类Dev

通过在PIG中的同一块内计算出的条件值在FOREACH块内进行过滤

来自分类Dev

为什么SASS变暗/变亮似乎计算出错误的灰度?

来自分类Dev

为什么我计算出的百分比在Android SDK中变为负数?

来自分类Dev

为什么我的词典没有正确计算出现次数?

来自分类Dev

为什么Flink用这种方式计算出Key的状态位置?

来自分类Dev

如何从C文本中计算出不同的单词?

来自分类Dev

为什么通过“工厂”创建的JSON与从“ API”获得的JSON不同?

来自分类Dev

为什么流(通过LAN)的速度和质量如此不同?

来自分类Dev

为什么带有splat参数的Ruby proc / block的行为与方法和lambda的行为不同?

来自分类Dev

为什么cpuinfo_cur_freq和/ proc / cpuinfo报告的数字不同?

来自分类Dev

为什么在CentOS 6和CentOS 7之间的/ proc / cpuinfo中得到不同的cpu标志?

来自分类Dev

Lisp:同一个数学函数在不同时间计算出不同的值?

来自分类Dev

VBA“中”功能计算出错误的值

来自分类Dev

/ proc / filesystems应该是什么,为什么与/ lib / modules / linux_ver / kernel / fs不同?

来自分类Dev

为什么DateTime.FromBinary在不同的计算机上返回不同的DateTime值

来自分类Dev

为什么ServicePointManager.SecurityProtocol的默认值在不同的计算机上不同?

来自分类Dev

通过键火花计算不同的值

来自分类Dev

为什么这些功能不同?

Related 相关文章

  1. 1

    为什么var()函数给我的答案不同于计算出的方差?

  2. 2

    Android:为什么计算出的可用空间与Android显示的可用空间不同

  3. 3

    为什么sklearns分类报告中的“加权”平均F1分数与通过公式计算出的F1分数不同?

  4. 4

    为什么Chrome开发人员工具计算出的样式与“样式”标签显示的有所不同?

  5. 5

    在VS和gcc上计算出的不同值

  6. 6

    选择不同的值,并计算出现次数

  7. 7

    为什么补码通过printf表现不同?

  8. 8

    是否可以将通过条件计算出的值插入到mysql中?

  9. 9

    通过插入从其他列计算出的值来更新rails mass更新列

  10. 10

    为什么Stata和R中一个样本的比例测试的95%CI不同

  11. 11

    通过在PIG中的同一块内计算出的条件值在FOREACH块内进行过滤

  12. 12

    通过在PIG中的同一块内计算出的条件值在FOREACH块内进行过滤

  13. 13

    为什么SASS变暗/变亮似乎计算出错误的灰度?

  14. 14

    为什么我计算出的百分比在Android SDK中变为负数?

  15. 15

    为什么我的词典没有正确计算出现次数?

  16. 16

    为什么Flink用这种方式计算出Key的状态位置?

  17. 17

    如何从C文本中计算出不同的单词?

  18. 18

    为什么通过“工厂”创建的JSON与从“ API”获得的JSON不同?

  19. 19

    为什么流(通过LAN)的速度和质量如此不同?

  20. 20

    为什么带有splat参数的Ruby proc / block的行为与方法和lambda的行为不同?

  21. 21

    为什么cpuinfo_cur_freq和/ proc / cpuinfo报告的数字不同?

  22. 22

    为什么在CentOS 6和CentOS 7之间的/ proc / cpuinfo中得到不同的cpu标志?

  23. 23

    Lisp:同一个数学函数在不同时间计算出不同的值?

  24. 24

    VBA“中”功能计算出错误的值

  25. 25

    / proc / filesystems应该是什么,为什么与/ lib / modules / linux_ver / kernel / fs不同?

  26. 26

    为什么DateTime.FromBinary在不同的计算机上返回不同的DateTime值

  27. 27

    为什么ServicePointManager.SecurityProtocol的默认值在不同的计算机上不同?

  28. 28

    通过键火花计算不同的值

  29. 29

    为什么这些功能不同?

热门标签

归档