
ROC curve and AUC by the trapezoid rule (Geron Ch 3, morie.fn grauc)
Source:R/geron_ml_native.R
morie_geron_auc_roc_trapezoid.RdOnly the last index of each run of tied scores becomes a vertex, so
the trapezoid sum equals the Mann-Whitney statistic. Same numbers as
morie_geron_auc_roc(), different construction – the two are each
other's independent check.
Examples
V <- c(1, 2, 3, 4, 5, 6, 7, 8)
morie_geron_auc_roc_trapezoid(V, V)
#> $auc
#> [1] 0
#>
#> $fpr
#> [1] 0.0000000 0.1428571 0.2857143 0.4285714 0.5714286 0.7142857 0.8571429
#> [8] 1.0000000 1.0000000
#>
#> $tpr
#> [1] 0 0 0 0 0 0 0 0 1
#>
#> $thresholds
#> [1] Inf 8 7 6 5 4 3 2 1
#>
#> $n_pos
#> [1] 1
#>
#> $n_neg
#> [1] 7
#>
#> $estimate
#> [1] 0
#>
#> $n
#> [1] 8
#>
#> $method
#> [1] "Area under the ROC curve (trapezoid rule)"
#>