nb_plot | R Documentation |
Produce a net benefit plot for a set of predicted probabilities for one or more binary classifiers.
nb_plot(
form,
data,
treat_all = TRUE,
treat_none = TRUE,
omniscient = TRUE,
weight = 1L,
max_neg = 0.1
)
form |
A formula where the left-hand side is the variable representing the observed outcome, 0 or 1, and the right-hand side represents the column names of the different model probabilities. |
data |
A data frame that contains at least two columns, one of which is the observed outcome and the others that are predicted probabilities. |
treat_all |
Whether or not to include a line indicating the net benefit of a model that treats everyone Default = TRUE |
treat_none |
Whether or not to include a line indicating the net benefit of a model that treats no one. Default = TRUE |
omniscient |
Whether or not to include a line indicating the net benefit of a model that guesses the actual observed outcome for each prediction. Default = TRUE |
weight |
Relative weighted importance of true positives to false positives. When weight = 1, the original net benefit calculation is used. Default = 1 |
max_neg |
The lower y-range below y = 0 that is plotted as a proportion of the highest possible net benefit. Default = 0.1 |
m1 <- glm(mpg > 20 ~ cyl + disp + hp, family = 'binomial', data = mtcars)
results <- data.frame(outcome = mtcars$mpg > 20, lr_1 = predict(m1, type = 'response'))
nb_plot(outcome ~ lr_1, data = results)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.