Learn R Programming

sigr (version 1.1.0)

find_AUC_q: Find area matching polynomial curve.

Description

Based on https://win-vector.com/2020/09/13/why-working-with-auc-is-more-powerful-than-one-might-think/

Usage

find_AUC_q(modelPredictions, yValues, ..., na.rm = FALSE, yTarget = TRUE)

Arguments

modelPredictions

numeric predictions (not empty), ordered (either increasing or decreasing)

yValues

truth values (not empty, same length as model predictions)

...

force later arguments to bind by name.

na.rm

logical, if TRUE remove NA values.

yTarget

value considered to be positive.

Value

area under curve

Examples

Run this code
# NOT RUN {
d <- data.frame(pred = 1:4, truth = c(TRUE,FALSE,TRUE,TRUE))
q <- find_AUC_q(d$pred, d$truth)
roc <- build_ROC_curve(d$pred, d$truth)
ideal_roc <- data.frame(Specificity = seq(0, 1, length.out = 101))
ideal_roc$Sensitivity <- 1 - (1 -  (1-ideal_roc$Specificity)^q^(1/q))
# ggplot(mapping = aes(x = 1 - Specificity, y = Sensitivity)) +
#   geom_line(data = roc, color = "DarkBlue") +
#   geom_line(data  = ideal_roc, color = "Orange") +
#   theme(aspect.ratio=1) +
#   ggtitle("example actual and ideal curve")

# }

Run the code above in your browser using DataLab