roc_auc {SONO}R Documentation

ROC AUC function

Description

Function computing the ROC AUC given a vector with scores of outlyingness. The computation for this is based on Hanley and McNeil (1982).

Usage

roc_auc(scores, outs, grid)

Arguments

scores

Scores of (nominal) outlyingness. A higher score here implies an observation is more likely to be an outlier.

outs

Vector of outlier indices.

grid

Grid of Top K values over which the ROC AUC is computed. Must be between 0 and 1.

Value

ROC AUC at the points of the provided grid.

References

Hanley JA, McNeil BJ (1982). “The meaning and use of the area under a receiver operating characteristic (ROC) curve.” Radiology, 143(1), 29–36. ISSN 0033-8419, doi:10.1148/radiology.143.1.7063747.

Examples

dt <- as.data.frame(sample(c(1:2), 100, replace = TRUE, prob = c(0.5, 0.5)))
dt <- cbind(dt, sample(c(1:3), 100, replace = TRUE, prob = c(0.5, 0.3, 0.2)))
dt[, 1] <- as.factor(dt[, 1])
dt[, 2] <- as.factor(dt[, 2])
colnames(dt) <- c('V1', 'V2')
sono_out <- sono(data = dt,
probs = list(c(0.5, 0.5), c(1/3, 1/3, 1/3)),
alpha = 0.01,
r = 2,
MAXLEN = 0,
frequent = FALSE)
# Suppose observations 1 up to 5 are outliers
roc_auc(scores = sono_out[[2]][, 2], outs = c(1:5),
grid = c(1, 2.5, seq(5, 50, by = 5))/100)


[Package SONO version 1.2 Index]