Intro Thoughts

Status Quo

library(tidyverse)
library(plotROC)

x <- rnorm(30000)

D.ex <- rbinom(50, 1, .5)

data.frame(D = c(D.ex, D.ex)) |> 
  mutate(M = c(rnorm(50, mean = D.ex, sd = .4), 
               rnorm(50, mean = D.ex, sd = 1)),
         Z = c(rep("A", 50), rep("B", 50))) |> 
  ggplot() + 
  aes(m = M, d = D) +
  geom_roc() + 
  aes(color = Z)

calc_auc(last_plot()) 
##   PANEL COORD group Z       AUC
## 1     1     1     1 A 0.9388084
## 2     1     1     2 B 0.8824477
last_plot() +
  stat_roc(geom = GeomArea, 
           aes(fill = after_scale(alpha(color, .2)))
           )

calc_auc(last_plot())
##   PANEL COORD group Z       AUC
## 1     1     1     1 A 0.9388084
## 2     1     1     2 B 0.8824477
last_plot() + 
  facet_wrap(~ Z) 

calc_auc(last_plot())
## Error in `[.data.frame`(auc_output_panels_groups, order(auc_output_panels_groups$PANEL, : undefined columns selected