plot_roc | R Documentation |
This functions plots ROC curves for one or several classifiers.
plot_roc( obs, pred, pal_curves = "npg", title = ifelse(is.numeric(pred), "ROC Curve", "ROC Curves"), leg.txt = NULL, legend = "bottomright", hover = FALSE )
obs |
Vector of observed outcomes. Must be dichotomous. Can be logical,
numeric, character, or factor. If numeric, |
pred |
Vector of predicted values, or several such vectors organized into a data frame or list, optionally named. Must be numeric. Common examples include the probabilities output by a logistic model, or the expression levels of a particular biomarker. |
pal_curves |
String specifying the color palette to use when plotting
multiple vectors. Options include |
title |
Optional plot title. |
leg.txt |
Optional legend title. |
legend |
Legend position. Must be one of |
hover |
Show predictor name by hovering mouse over ROC curve? If |
ROC curves plot the false positive rate (i.e., 1 - specificity) against the true positive rate (i.e., sensitivity) for a given classifier and vector of observations. The area under the ROC curve (AUC) is a common performance metric for binary classifiers. The grey diagonal line across the plot represents the performance of a theoretical random classifier.
y <- rbinom(1000, size = 1, prob = 0.5) x1 <- rnorm(1000, mean = y) plot_roc(obs = y, pred = x1) x2 <- rnorm(1000, mean = y, sd = 2) plot_roc(obs = y, pred = list("Better" = x1, "Worse" = x2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.