Skip to contents

Native empirical ROC curve, computed exactly as pROC::roc does with levels = c(0, 1), direction = "<": candidate thresholds are -Inf, the midpoints between consecutive distinct scores and +Inf (with pROC's near-tie correction), a case is called positive when its score is >= the threshold, and the AUC is the trapezoid area under (specificity, sensitivity), which equals the Mann-Whitney U probability with ties credited 0.5. Observations with a missing label or score are dropped from the curve (pROC's na.rm = TRUE).

Usage

morie_roc_auc_score(y_true, y_score)

Arguments

y_true

Binary labels.

y_score

Predicted scores for the positive class.

Value

Named list: estimate, auc, fpr, tpr, thresholds, n, n_positive, n_negative, method.

Examples

set.seed(1)
y <- rbinom(50, 1, 0.5)
morie_roc_auc_score(y, y + rnorm(50))$auc
#> [1] 0.7568438