Skip to contents

The area under the ROC curve of a score: the chance that a case with the outcome gets a higher score than a case without it. 0.5 is a coin toss, 1 a perfect ranking.

Usage

vp_auc(score, outcome)

Arguments

score

A numeric score of each case (higher: the outcome is predicted more strongly).

outcome

A logical vector: whether each case had the outcome.

Value

A number between 0 and 1, or NA when outcome has only one value.

Examples

vp_auc(c(0.9, 0.8, 0.3, 0.1), c(TRUE, TRUE, FALSE, FALSE))
#> [1] 1
vp_auc(c(0.1, 0.8, 0.3, 0.9), c(TRUE, TRUE, FALSE, FALSE))
#> [1] 0.25