Skip to contents

TPR against FPR over the distinct scores (ties collapsed into one point), AUC by the trapezoid rule.

Usage

morie_geron_roc_curve(y_true, y_scores)

Arguments

y_true

Binary 0/1 labels.

y_scores

Decision scores.

Value

List with fpr, tpr, thresholds, auc.

Examples

set.seed(1)
y <- rbinom(30, 1, 0.5)
s <- y + rnorm(30, 0, 0.7)
morie_geron_roc_curve(y, s)
#> $fpr
#>  [1] 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000
#> [11] 0.0625 0.0625 0.1250 0.1250 0.1875 0.2500 0.3125 0.3750 0.3750 0.4375
#> [21] 0.4375 0.5000 0.5625 0.6250 0.6875 0.7500 0.8125 0.8750 0.9375 0.9375
#> [31] 1.0000
#> 
#> $tpr
#>  [1] 0.00000000 0.07142857 0.14285714 0.21428571 0.28571429 0.35714286
#>  [7] 0.42857143 0.50000000 0.57142857 0.64285714 0.64285714 0.71428571
#> [13] 0.71428571 0.78571429 0.78571429 0.78571429 0.78571429 0.78571429
#> [19] 0.85714286 0.85714286 0.92857143 0.92857143 0.92857143 0.92857143
#> [25] 0.92857143 0.92857143 0.92857143 0.92857143 0.92857143 1.00000000
#> [31] 1.00000000
#> 
#> $thresholds
#>  [1]         Inf  1.66068535  1.64328416  1.57485484  1.54749541  1.38966424
#>  [7]  1.29255909  1.27137013  1.05219549  0.95848062  0.95107569  0.92804859
#> [13]  0.77001776  0.70950381  0.53422302  0.48787436  0.43387802  0.41573092
#> [19]  0.03605831 -0.01133318 -0.02952667 -0.03145353 -0.03766353 -0.03929012
#> [25] -0.10905685 -0.11516652 -0.17735318 -0.27600297 -0.33470504 -0.39254619
#> [31] -0.48212899
#> 
#> $auc
#> [1] 0.8616071
#> 
#> $estimate
#> [1] 0.8616071
#> 
#> $n
#> [1] 30
#>