auc: Compute area under the ROC curve

View source: R/auc.R

aucR Documentation

Compute area under the ROC curve

Description

Compute area under the ROC curve

Usage

auc(y, prob, w = NULL)

Arguments

y

Binary 0/1 vector, including logical, character, or factor encodings.

prob

Finite numeric scores, one per label; values outside ⁠[0, 1]⁠ are allowed.

w

Optional finite nonnegative numeric sample weights; NULL means unit weights.

Value

Numeric rank AUC with half credit for ties; NA with a warning if either effective class mass is zero.

References

Zhou et al. (2022). doi:10.1371/journal.pcbi.1009956

See Also

auc_matrix(), get_auc()

Examples

y <- c(0, 0, 1, 1)
p <- c(0.1, 0.3, 0.7, 0.9)
auc(y, p)

xplus documentation built on Sept. 26, 2026, 5:07 p.m.