plot_incidence_vs_coverage: do PRROC analysis for a vector of true outputs and a vector...

plot_incidence_vs_coverageR Documentation

do PRROC analysis for a vector of true outputs and a vector of raw predictions

Description

do PRROC analysis for a vector of true outputs and a vector of raw predictions

Usage

plot_incidence_vs_coverage(
  df,
  my_output,
  my_pred,
  my_title = "",
  weights = NULL,
  option = "nse",
  include_f1_score = F
)

Arguments

df

a data frame

my_output

a vector of binary outputs from df (0, 1 or NA)

my_pred

a vector of numeric predictions between 0 and 1 from df (no NA's allowed)

my_title

a title for the plot

weights

a vector of weights from df

option

'nse' if passing vectors using non-standard evaluation, 'character' if passing the names of the vectors

include_f1_score

boolean indicating whether f1 score of incidence and coverage should be included in plot and table

Value

A list. Element one is a plot of cutoff versus incidence/coverage. Element two is a data frame summarizing performance for each cutoff

Examples

library(dplyr)
mtcars %>%
   mutate(across(qsec, ~(.x - min(qsec)) / (max(qsec) - min(qsec)))) %>%
   plot_incidence_vs_coverage(vs, qsec)
mtcars %>%
  mutate(across(qsec, ~(.x - min(qsec)) / (max(qsec) - min(qsec)))) %>%
  plot_incidence_vs_coverage('vs', 'qsec', option = 'character')
mtcars %>%
   mutate(across(qsec, ~(.x - min(qsec)) / (max(qsec) - min(qsec))),
          weights = runif(nrow(.))) %>%
   plot_incidence_vs_coverage(vs, qsec, weights = weights)
mtcars %>%
  mutate(across(qsec, ~(.x - min(qsec)) / (max(qsec) - min(qsec))),
         weights = runif(nrow(.))) %>%
  plot_incidence_vs_coverage('vs', 'qsec', weights = 'weights', option = 'character')


PatrickCoyle/cmisc documentation built on June 23, 2022, 3:07 p.m.