Add ROC columns derived from sensitivity and specificity.

add_ROC_derived_columns(d, positive_prevalence)

Arguments

d

input data frame, must at lest of columns Sensitivity and Specificity

positive_prevalence

scalar, the prevalence of the positive class or prior odds

Value

extended data frame with more columns

Examples

d <- data.frame(pred = 1:4, truth = c(TRUE,FALSE,TRUE,TRUE)) roc <- build_ROC_curve(d$pred, d$truth) add_ROC_derived_columns(roc, mean(d$truth))
#> Score Sensitivity Specificity FalsePositiveRate TruePositiveRate #> 1 NA 0.0000000 1 0 0.0000000 #> 2 4 0.3333333 1 0 0.3333333 #> 3 3 0.6666667 1 0 0.6666667 #> 4 2 0.6666667 0 1 0.6666667 #> 5 1 1.0000000 0 1 1.0000000 #> TrueNegativeRate FalseNegativeRate false_positive_prevalence #> 1 1 1.0000000 0.00 #> 2 1 0.6666667 0.00 #> 3 1 0.3333333 0.00 #> 4 0 0.3333333 0.25 #> 5 0 0.0000000 0.25 #> true_positive_prevalence true_negative_prevalence false_negative_prevalence #> 1 0.00 0.25 0.75 #> 2 0.25 0.25 0.50 #> 3 0.50 0.25 0.25 #> 4 0.50 0.00 0.25 #> 5 0.75 0.00 0.00