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 <- sensitivity_from_specificity_q(ideal_roc$Specificity, q)
# library(ggplot2)
# 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