| dca | R Documentation |
Computes net benefit across a range of risk thresholds for a binary classifier's predicted probabilities, alongside the "treat all" and "treat none" reference strategies (Vickers and Elkin, 2006).
dca(truth, prob, positive = NULL, thresholds = seq(0.01, 0.99, by = 0.01))
truth |
Factor (or coercible to factor) of true class labels. |
prob |
Predicted probability of the positive class, or a probability matrix/data frame with one column per class level. |
positive |
Optional positive class level. Defaults to the second factor level. |
thresholds |
Numeric vector of risk thresholds in (0, 1). |
A data frame with threshold, model, treat_all, and
treat_none net benefit columns.
set.seed(1)
truth <- factor(rbinom(200, 1, 0.3))
prob <- pmin(pmax(rnorm(200, mean = ifelse(truth == 1, 0.6, 0.3), sd = 0.15), 0), 1)
dca(truth, prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.