pROC test run

References

coords() examples in the Reference Manual

## Load pROC
library(pROC)
## Load data
data(aSAH)
## Print a roc object:
rocobj <- roc(aSAH$outcome, aSAH$s100b)
names(rocobj)
 [1] "levels"             "percent"            "call"               "sensitivities"      "specificities"     
 [6] "thresholds"         "direction"          "cases"              "controls"           "original.predictor"
[11] "predictor"          "response"           "auc"               
## Plot deciles of possible thresholds
plot(rocobj, print.thres = quantile(rocobj$thresholds, seq(0,1,0.1)))

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$s100b)

Data: aSAH$s100b in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 0.731
## At threshold 0.55
coords(rocobj, 0.55)
  threshold specificity sensitivity 
     0.5500      1.0000      0.2683 
## At all possible thresholds in the dataset
t(coords(roc = rocobj, x = rocobj$thresholds))
      threshold specificity sensitivity
-Inf       -Inf     0.00000     1.00000
0.035     0.035     0.00000     0.97561
0.045     0.045     0.06944     0.97561
0.055     0.055     0.11111     0.97561
0.065     0.065     0.13889     0.97561
0.075     0.075     0.22222     0.90244
0.085     0.085     0.30556     0.87805
0.095     0.095     0.38889     0.82927
0.105     0.105     0.48611     0.78049
0.115     0.115     0.54167     0.75610
0.125     0.125     0.54167     0.73171
0.135     0.135     0.58333     0.68293
0.145     0.145     0.63889     0.65854
0.155     0.155     0.69444     0.65854
0.165     0.165     0.73611     0.63415
0.175     0.175     0.76389     0.63415
0.185     0.185     0.77778     0.63415
0.205     0.205     0.80556     0.63415
0.225     0.225     0.80556     0.60976
0.235     0.235     0.80556     0.58537
0.245     0.245     0.81944     0.58537
0.255     0.255     0.81944     0.56098
0.265     0.265     0.81944     0.53659
0.275     0.275     0.81944     0.51220
0.29      0.290     0.83333     0.51220
0.31      0.310     0.83333     0.48780
0.325     0.325     0.84722     0.46341
0.335     0.335     0.86111     0.43902
0.345     0.345     0.87500     0.43902
0.365     0.365     0.87500     0.41463
0.395     0.395     0.88889     0.41463
0.42      0.420     0.88889     0.39024
0.435     0.435     0.90278     0.39024
0.445     0.445     0.90278     0.34146
0.455     0.455     0.91667     0.34146
0.465     0.465     0.93056     0.34146
0.475     0.475     0.95833     0.34146
0.485     0.485     0.97222     0.31707
0.495     0.495     0.97222     0.29268
0.51      0.510     1.00000     0.29268
0.54      0.540     1.00000     0.26829
0.57      0.570     1.00000     0.24390
0.64      0.640     1.00000     0.21951
0.705     0.705     1.00000     0.19512
0.725     0.725     1.00000     0.14634
0.755     0.755     1.00000     0.12195
0.795     0.795     1.00000     0.09756
0.84      0.840     1.00000     0.07317
0.91      0.910     1.00000     0.04878
1.515     1.515     1.00000     0.02439
Inf         Inf     1.00000     0.00000
t(coords(roc = rocobj, x = "all"))
    threshold specificity sensitivity
all      -Inf     0.00000     1.00000
all     0.035     0.00000     0.97561
all     0.045     0.06944     0.97561
all     0.055     0.11111     0.97561
all     0.065     0.13889     0.97561
all     0.075     0.22222     0.90244
all     0.085     0.30556     0.87805
all     0.095     0.38889     0.82927
all     0.105     0.48611     0.78049
all     0.115     0.54167     0.75610
all     0.125     0.54167     0.73171
all     0.135     0.58333     0.68293
all     0.145     0.63889     0.65854
all     0.155     0.69444     0.65854
all     0.165     0.73611     0.63415
all     0.175     0.76389     0.63415
all     0.185     0.77778     0.63415
all     0.205     0.80556     0.63415
all     0.225     0.80556     0.60976
all     0.235     0.80556     0.58537
all     0.245     0.81944     0.58537
all     0.255     0.81944     0.56098
all     0.265     0.81944     0.53659
all     0.275     0.81944     0.51220
all     0.290     0.83333     0.51220
all     0.310     0.83333     0.48780
all     0.325     0.84722     0.46341
all     0.335     0.86111     0.43902
all     0.345     0.87500     0.43902
all     0.365     0.87500     0.41463
all     0.395     0.88889     0.41463
all     0.420     0.88889     0.39024
all     0.435     0.90278     0.39024
all     0.445     0.90278     0.34146
all     0.455     0.91667     0.34146
all     0.465     0.93056     0.34146
all     0.475     0.95833     0.34146
all     0.485     0.97222     0.31707
all     0.495     0.97222     0.29268
all     0.510     1.00000     0.29268
all     0.540     1.00000     0.26829
all     0.570     1.00000     0.24390
all     0.640     1.00000     0.21951
all     0.705     1.00000     0.19512
all     0.725     1.00000     0.14634
all     0.755     1.00000     0.12195
all     0.795     1.00000     0.09756
all     0.840     1.00000     0.07317
all     0.910     1.00000     0.04878
all     1.515     1.00000     0.02439
all       Inf     1.00000     0.00000
## iput specificity instead of threshold 
coords(roc = rocobj, x = 0.9, input = "specificity", as.list = TRUE)
$threshold
[1] NA

$specificity
[1] 0.9

$sensitivity
[1] 0.3902
## Input sensitivity and return sensitivity
coords(rocobj, 0.5, "se", ret = "se")
[1] 0.5
## fully qualified but identical (Input sensitivity and return sensitivity)
coords(roc = rocobj, x = 0.5, input = "sensitivity", ret = "sensitivity")
[1] 0.5
## Compare with drop=FALSE
coords(rocobj, 0.55, drop = FALSE)
              0.55
threshold   0.5500
specificity 1.0000
sensitivity 0.2683
coords(rocobj, 0.9, "specificity", as.list = TRUE, drop = FALSE)
$`0.9`
$`0.9`$threshold
[1] NA

$`0.9`$specificity
[1] 0.9

$`0.9`$sensitivity
[1] 0.3902
## Same in percent
rocobj <- roc(aSAH$outcome, aSAH$s100b, percent = TRUE)
coords(rocobj, 0.55)
  threshold specificity sensitivity 
       0.55      100.00       26.83 
coords(rocobj, 90, "specificity", as.list = TRUE)
$threshold
[1] NA

$specificity
[1] 90

$sensitivity
[1] 39.02
coords(rocobj, x = 50, input = "sensitivity", ret = c("sen", "spec"))
sensitivity specificity 
      50.00       83.33 
## And with a smoothed ROC curve
plot(smooth(rocobj))

plot of chunk unnamed-chunk-2


Call:
smooth.roc(roc = rocobj)

Data: aSAH$s100b in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Smoothing: binormal
Area under the curve: 74%
coords(smooth(rocobj), 90, "specificity")
specificity sensitivity 
      90.00       41.21 
coords(smooth(rocobj), 90, "specificity", drop = FALSE)
               90
specificity 90.00
sensitivity 41.21
coords(smooth(rocobj), 90, "specificity", as.list = TRUE)
$specificity
[1] 90

$sensitivity
[1] 41.21
coords(smooth(rocobj), 90, "specificity", as.list = TRUE, drop = FALSE)
$`90`
$`90`$specificity
[1] 90

$`90`$sensitivity
[1] 41.21
## Get the sensitivities for all thresholds
sensitivities <- coords(rocobj, rocobj$thresholds, "thr", "se")
sensitivities
            -Inf 0.035 0.045 0.055 0.065 0.075 0.085 0.095 0.105 0.115 0.125 0.135 0.145 0.155 0.165 0.175 0.185
sensitivity  100 97.56 97.56 97.56 97.56 90.24  87.8 82.93 78.05 75.61 73.17 68.29 65.85 65.85 63.41 63.41 63.41
            0.205 0.225 0.235 0.245 0.255 0.265 0.275  0.29  0.31 0.325 0.335 0.345 0.365 0.395  0.42 0.435 0.445
sensitivity 63.41 60.98 58.54 58.54  56.1 53.66 51.22 51.22 48.78 46.34  43.9  43.9 41.46 41.46 39.02 39.02 34.15
            0.455 0.465 0.475 0.485 0.495  0.51  0.54  0.57  0.64 0.705 0.725 0.755 0.795  0.84  0.91 1.515 Inf
sensitivity 34.15 34.15 34.15 31.71 29.27 29.27 26.83 24.39 21.95 19.51 14.63  12.2 9.756 7.317 4.878 2.439   0
## You could also write:
sensitivities <- coords(roc = rocobj, x = "all", ret="se")
sensitivities
            all   all   all   all   all   all  all   all   all   all   all   all   all   all   all   all   all
sensitivity 100 97.56 97.56 97.56 97.56 90.24 87.8 82.93 78.05 75.61 73.17 68.29 65.85 65.85 63.41 63.41 63.41
              all   all   all   all  all   all   all   all   all   all  all  all   all   all   all   all   all
sensitivity 63.41 60.98 58.54 58.54 56.1 53.66 51.22 51.22 48.78 46.34 43.9 43.9 41.46 41.46 39.02 39.02 34.15
              all   all   all   all   all   all   all   all   all   all   all  all   all   all   all   all all
sensitivity 34.15 34.15 34.15 31.71 29.27 29.27 26.83 24.39 21.95 19.51 14.63 12.2 9.756 7.317 4.878 2.439   0
## Get the best threshold
coords(roc = rocobj, x = "best", ret = "threshold")
[1] 0.205
## Get the best threshold according to different methods
rocobj <- roc(aSAH$outcome, aSAH$ndka, percent = TRUE)
## default Youden
coords(rocobj, "b", ret = "t", best.method = "youden")
[1] 11.08
## closest.topleft
coords(rocobj, "b", ret = "t", best.method = "closest.topleft")
[1] 12.73
## and with different weights: best.weights = c(Cost of FN, Prevalence)
coords(rocobj, "b", ret = "t", best.method = "youden", best.weights = c(50, 0.2))
[1] 3.44
coords(rocobj, "b", ret = "t", best.method = "closest.topleft", best.weights = c(5, 0.2))
[1] 11.08
## and plot them
plot(rocobj, print.thres = "best", print.thres.best.method = "youden")

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$ndka, percent = TRUE)

Data: aSAH$ndka in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 61.2%
plot(rocobj, print.thres = "best", print.thres.best.method = "closest.topleft")

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$ndka, percent = TRUE)

Data: aSAH$ndka in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 61.2%
plot(rocobj, print.thres = "best", print.thres.best.method = "youden",
     print.thres.best.weights=c(50, 0.2))

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$ndka, percent = TRUE)

Data: aSAH$ndka in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 61.2%
plot(rocobj, print.thres="best", print.thres.best.method="closest.topleft",
     print.thres.best.weights=c(5, 0.2))

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$ndka, percent = TRUE)

Data: aSAH$ndka in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 61.2%
## Plot deciles of possible thresholds
plot(rocobj, print.thres = quantile(rocobj$thresholds, seq(0,1,0.1)))

plot of chunk unnamed-chunk-2


Call:
roc.default(response = aSAH$outcome, predictor = aSAH$ndka, percent = TRUE)

Data: aSAH$ndka in 72 controls (aSAH$outcome Good) < 41 cases (aSAH$outcome Poor).
Area under the curve: 61.2%
## Return more values:
all.values <- c("threshold", "specificity", "sensitivity", "accuracy", "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity", "1-sensitivity", "1-npv", "1-ppv")
t(coords(rocobj, "all", ret = all.values))
    threshold specificity sensitivity accuracy tn tp fn fp    npv    ppv 1-specificity 1-sensitivity 1-npv 1-ppv
all      -Inf       0.000     100.000   0.3628  0 41  0 72    NaN  36.28       100.000         0.000   NaN 63.72
all     3.440       1.389     100.000   0.3717  1 41  0 71 100.00  36.61        98.611         0.000  0.00 63.39
all     4.240       1.389      97.561   0.3628  1 40  1 71  50.00  36.04        98.611         2.439 50.00 63.96
all     4.820       2.778      97.561   0.3717  2 40  1 70  66.67  36.36        97.222         2.439 33.33 63.64
all     5.105       4.167      97.561   0.3805  3 40  1 69  75.00  36.70        95.833         2.439 25.00 63.30
all     5.185       4.167      95.122   0.3717  3 39  2 69  60.00  36.11        95.833         4.878 40.00 63.89
all     5.280       4.167      92.683   0.3628  3 38  3 69  50.00  35.51        95.833         7.317 50.00 64.49
all     5.685       4.167      90.244   0.3540  3 37  4 69  42.86  34.91        95.833         9.756 57.14 65.09
all     6.005       5.556      90.244   0.3628  4 37  4 68  50.00  35.24        94.444         9.756 50.00 64.76
all     6.150       6.944      90.244   0.3717  5 37  4 67  55.56  35.58        93.056         9.756 44.44 64.42
all     6.295       8.333      90.244   0.3805  6 37  4 66  60.00  35.92        91.667         9.756 40.00 64.08
all     6.345       9.722      90.244   0.3894  7 37  4 65  63.64  36.27        90.278         9.756 36.36 63.73
all     6.465      11.111      90.244   0.3982  8 37  4 64  66.67  36.63        88.889         9.756 33.33 63.37
all     6.565      12.500      90.244   0.4071  9 37  4 63  69.23  37.00        87.500         9.756 30.77 63.00
all     6.690      13.889      90.244   0.4159 10 37  4 62  71.43  37.37        86.111         9.756 28.57 62.63
all     6.925      15.278      90.244   0.4248 11 37  4 61  73.33  37.76        84.722         9.756 26.67 62.24
all     7.240      16.667      90.244   0.4336 12 37  4 60  75.00  38.14        83.333         9.756 25.00 61.86
all     7.525      16.667      87.805   0.4248 12 36  5 60  70.59  37.50        83.333        12.195 29.41 62.50
all     7.645      18.056      87.805   0.4336 13 36  5 59  72.22  37.89        81.944        12.195 27.78 62.11
all     7.705      19.444      87.805   0.4425 14 36  5 58  73.68  38.30        80.556        12.195 26.32 61.70
all     7.855      20.833      87.805   0.4513 15 36  5 57  75.00  38.71        79.167        12.195 25.00 61.29
all     7.990      22.222      87.805   0.4602 16 36  5 56  76.19  39.13        77.778        12.195 23.81 60.87
all     8.055      23.611      87.805   0.4690 17 36  5 55  77.27  39.56        76.389        12.195 22.73 60.44
all     8.160      25.000      87.805   0.4779 18 36  5 54  78.26  40.00        75.000        12.195 21.74 60.00
all     8.305      25.000      85.366   0.4690 18 35  6 54  75.00  39.33        75.000        14.634 25.00 60.67
all     8.455      25.000      82.927   0.4602 18 34  7 54  72.00  38.64        75.000        17.073 28.00 61.36
all     8.535      26.389      82.927   0.4690 19 34  7 53  73.08  39.08        73.611        17.073 26.92 60.92
all     8.720      27.778      82.927   0.4779 20 34  7 52  74.07  39.53        72.222        17.073 25.93 60.47
all     8.955      27.778      80.488   0.4690 20 33  8 52  71.43  38.82        72.222        19.512 28.57 61.18
all     9.225      29.167      80.488   0.4779 21 33  8 51  72.41  39.29        70.833        19.512 27.59 60.71
all     9.455      31.944      80.488   0.4956 23 33  8 49  74.19  40.24        68.056        19.512 25.81 59.76
all     9.520      33.333      80.488   0.5044 24 33  8 48  75.00  40.74        66.667        19.512 25.00 59.26
all     9.600      33.333      78.049   0.4956 24 32  9 48  72.73  40.00        66.667        21.951 27.27 60.00
all     9.665      34.722      75.610   0.4956 25 31 10 47  71.43  39.74        65.278        24.390 28.57 60.26
all     9.750      36.111      75.610   0.5044 26 31 10 46  72.22  40.26        63.889        24.390 27.78 59.74
all     9.805      37.500      75.610   0.5133 27 31 10 45  72.97  40.79        62.500        24.390 27.03 59.21
all     9.820      38.889      75.610   0.5221 28 31 10 44  73.68  41.33        61.111        24.390 26.32 58.67
all     9.840      40.278      75.610   0.5310 29 31 10 43  74.36  41.89        59.722        24.390 25.64 58.11
all     9.900      40.278      73.171   0.5221 29 30 11 43  72.50  41.10        59.722        26.829 27.50 58.90
all    10.140      41.667      73.171   0.5310 30 30 11 42  73.17  41.67        58.333        26.829 26.83 58.33
all    10.365      43.056      73.171   0.5398 31 30 11 41  73.81  42.25        56.944        26.829 26.19 57.75
all    10.410      43.056      70.732   0.5310 31 29 12 41  72.09  41.43        56.944        29.268 27.91 58.57
all    10.465      44.444      70.732   0.5398 32 29 12 40  72.73  42.03        55.556        29.268 27.27 57.97
all    10.530      45.833      70.732   0.5487 33 29 12 39  73.33  42.65        54.167        29.268 26.67 57.35
all    10.575      47.222      70.732   0.5575 34 29 12 38  73.91  43.28        52.778        29.268 26.09 56.72
all    10.715      48.611      70.732   0.5664 35 29 12 37  74.47  43.94        51.389        29.268 25.53 56.06
all    10.950      50.000      70.732   0.5752 36 29 12 36  75.00  44.62        50.000        29.268 25.00 55.38
all    11.080      51.389      70.732   0.5841 37 29 12 35  75.51  45.31        48.611        29.268 24.49 54.69
all    11.345      51.389      68.293   0.5752 37 28 13 35  74.00  44.44        48.611        31.707 26.00 55.56
all    11.635      51.389      65.854   0.5664 37 27 14 35  72.55  43.55        48.611        34.146 27.45 56.45
all    11.675      51.389      63.415   0.5575 37 26 15 35  71.15  42.62        48.611        36.585 28.85 57.38
all    11.700      52.778      63.415   0.5664 38 26 15 34  71.70  43.33        47.222        36.585 28.30 56.67
all    11.725      52.778      60.976   0.5575 38 25 16 34  70.37  42.37        47.222        39.024 29.63 57.63
all    11.850      54.167      60.976   0.5664 39 25 16 33  70.91  43.10        45.833        39.024 29.09 56.90
all    12.095      55.556      60.976   0.5752 40 25 16 32  71.43  43.86        44.444        39.024 28.57 56.14
all    12.375      55.556      58.537   0.5664 40 24 17 32  70.18  42.86        44.444        41.463 29.82 57.14
all    12.550      56.944      58.537   0.5752 41 24 17 31  70.69  43.64        43.056        41.463 29.31 56.36
all    12.580      58.333      58.537   0.5841 42 24 17 30  71.19  44.44        41.667        41.463 28.81 55.56
all    12.630      59.722      58.537   0.5929 43 24 17 29  71.67  45.28        40.278        41.463 28.33 54.72
all    12.690      61.111      58.537   0.6018 44 24 17 28  72.13  46.15        38.889        41.463 27.87 53.85
all    12.730      62.500      58.537   0.6106 45 24 17 27  72.58  47.06        37.500        41.463 27.42 52.94
all    12.775      62.500      56.098   0.6018 45 23 18 27  71.43  46.00        37.500        43.902 28.57 54.00
all    12.850      63.889      56.098   0.6106 46 23 18 26  71.88  46.94        36.111        43.902 28.12 53.06
all    12.940      65.278      53.659   0.6106 47 22 19 25  71.21  46.81        34.722        46.341 28.79 53.19
all    13.050      66.667      53.659   0.6195 48 22 19 24  71.64  47.83        33.333        46.341 28.36 52.17
all    13.160      68.056      53.659   0.6283 49 22 19 23  72.06  48.89        31.944        46.341 27.94 51.11
all    13.305      68.056      51.220   0.6195 49 21 20 23  71.01  47.73        31.944        48.780 28.99 52.27
all    13.430      69.444      51.220   0.6283 50 21 20 22  71.43  48.84        30.556        48.780 28.57 51.16
all    13.505      70.833      51.220   0.6372 51 21 20 21  71.83  50.00        29.167        48.780 28.17 50.00
all    13.615      70.833      48.780   0.6283 51 20 21 21  70.83  48.78        29.167        51.220 29.17 51.22
all    13.770      70.833      46.341   0.6195 51 19 22 21  69.86  47.50        29.167        53.659 30.14 52.50
all    13.955      72.222      46.341   0.6283 52 19 22 20  70.27  48.72        27.778        53.659 29.73 51.28
all    14.150      72.222      43.902   0.6195 52 18 23 20  69.33  47.37        27.778        56.098 30.67 52.63
all    14.300      72.222      41.463   0.6106 52 17 24 20  68.42  45.95        27.778        58.537 31.58 54.05
all    14.455      73.611      41.463   0.6195 53 17 24 19  68.83  47.22        26.389        58.537 31.17 52.78
all    15.055      75.000      41.463   0.6283 54 17 24 18  69.23  48.57        25.000        58.537 30.77 51.43
all    15.715      76.389      39.024   0.6283 55 16 25 17  68.75  48.48        23.611        60.976 31.25 51.52
all    15.925      76.389      36.585   0.6195 55 15 26 17  67.90  46.88        23.611        63.415 32.10 53.12
all    16.035      76.389      34.146   0.6106 55 14 27 17  67.07  45.16        23.611        65.854 32.93 54.84
all    16.660      77.778      34.146   0.6195 56 14 27 16  67.47  46.67        22.222        65.854 32.53 53.33
all    17.255      79.167      34.146   0.6283 57 14 27 15  67.86  48.28        20.833        65.854 32.14 51.72
all    17.350      80.556      34.146   0.6372 58 14 27 14  68.24  50.00        19.444        65.854 31.76 50.00
all    17.630      80.556      31.707   0.6283 58 13 28 14  67.44  48.15        19.444        68.293 32.56 51.85
all    18.035      81.944      31.707   0.6372 59 13 28 13  67.82  50.00        18.056        68.293 32.18 50.00
all    18.835      83.333      31.707   0.6460 60 13 28 12  68.18  52.00        16.667        68.293 31.82 48.00
all    20.105      84.722      31.707   0.6549 61 13 28 11  68.54  54.17        15.278        68.293 31.46 45.83
all    20.985      86.111      31.707   0.6637 62 13 28 10  68.89  56.52        13.889        68.293 31.11 43.48
all    21.350      86.111      29.268   0.6549 62 12 29 10  68.13  54.55        13.889        70.732 31.87 45.45
all    21.525      86.111      26.829   0.6460 62 11 30 10  67.39  52.38        13.889        73.171 32.61 47.62
all    21.750      86.111      24.390   0.6372 62 10 31 10  66.67  50.00        13.889        75.610 33.33 50.00
all    22.100      86.111      21.951   0.6283 62  9 32 10  65.96  47.37        13.889        78.049 34.04 52.63
all    22.350      87.500      21.951   0.6372 63  9 32  9  66.32  50.00        12.500        78.049 33.68 50.00
all    22.530      88.889      21.951   0.6460 64  9 32  8  66.67  52.94        11.111        78.049 33.33 47.06
all    23.605      88.889      19.512   0.6372 64  8 33  8  65.98  50.00        11.111        80.488 34.02 50.00
all    25.885      90.278      19.512   0.6460 65  8 33  7  66.33  53.33         9.722        80.488 33.67 46.67
all    27.840      91.667      19.512   0.6549 66  8 33  6  66.67  57.14         8.333        80.488 33.33 42.86
all    30.430      93.056      19.512   0.6637 67  8 33  5  67.00  61.54         6.944        80.488 33.00 38.46
all    32.390      93.056      17.073   0.6549 67  7 34  5  66.34  58.33         6.944        82.927 33.66 41.67
all    33.235      93.056      14.634   0.6460 67  6 35  5  65.69  54.55         6.944        85.366 34.31 45.45
all    37.200      93.056      12.195   0.6372 67  5 36  5  65.05  50.00         6.944        87.805 34.95 50.00
all    40.885      93.056       9.756   0.6283 67  4 37  5  64.42  44.44         6.944        90.244 35.58 55.56
all    44.130      94.444       9.756   0.6372 68  4 37  4  64.76  50.00         5.556        90.244 35.24 50.00
all    47.220      95.833       9.756   0.6460 69  4 37  3  65.09  57.14         4.167        90.244 34.91 42.86
all    48.775      95.833       7.317   0.6372 69  3 38  3  64.49  50.00         4.167        92.683 35.51 50.00
all    52.380      97.222       7.317   0.6460 70  3 38  2  64.81  60.00         2.778        92.683 35.19 40.00
all    56.825      97.222       4.878   0.6372 70  2 39  2  64.22  50.00         2.778        95.122 35.78 50.00
all    65.700      98.611       4.878   0.6460 71  2 39  1  64.55  66.67         1.389        95.122 35.45 33.33
all    76.435      98.611       2.439   0.6372 71  1 40  1  63.96  50.00         1.389        97.561 36.04 50.00
all   249.745     100.000       2.439   0.6460 72  1 40  0  64.29 100.00         0.000        97.561 35.71  0.00
all       Inf     100.000       0.000   0.6372 72  0 41  0  63.72    NaN         0.000       100.000 36.28   NaN
coords(smooth(rocobj), "best", ret=c("threshold", "specificity", "sensitivity", "accuracy",
                                   "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity",
                                   "1-sensitivity", "1-npv", "1-ppv"))
  specificity   sensitivity      accuracy            tn            tp            fn            fp           npv 
      67.2642       47.5538        0.6011       48.4303       19.4971       21.5029       23.5697       69.2522 
          ppv 1-specificity 1-sensitivity         1-npv         1-ppv 
      45.2717       32.7358       52.4462       30.7478       54.7283 
coords(smooth(rocobj), 0.5, ret=c("threshold", "specificity", "sensitivity", "accuracy",
                                "tn", "tp", "fn", "fp", "npv", "ppv", "1-specificity",
                                "1-sensitivity", "1-npv", "1-ppv"))
  specificity   sensitivity      accuracy            tn            tp            fn            fp           npv 
       0.5000       99.6298        0.3647        0.3600       40.8482        0.1518       71.6400       70.3435 
          ppv 1-specificity 1-sensitivity         1-npv         1-ppv 
      36.3133       99.5000        0.3702       29.6565       63.6867