plotAUC | R Documentation |
This function generates a Receiver Operating Characteristic (ROC) curve and computes the Area Under the Curve (AUC) along with the corresponding confidence intervals. It also highlights the best threshold using Youden's index.
plotAUC(score, y, main = "", ci = TRUE, percent = TRUE)
score |
A numeric vector containing the predicted scores from the model. |
y |
A numeric or factor vector containing the true class labels. The labels should be binary, with two levels (e.g., 1 and -1, or 0 and 1). |
main |
A string representing the title of the plot. Default is an empty string. |
ci |
A logical value indicating whether to compute and display the confidence intervals for the AUC. Default is 'TRUE'. |
percent |
A logical value indicating whether to express the ROC curve in percentage scale. Default is 'TRUE'. |
The function uses the 'pROC' package to compute and plot the ROC curve and AUC. The best threshold is determined using Youden’s index, and it is displayed on the plot with vertical and horizontal lines. The plot includes the AUC value and its confidence intervals, as well as the best threshold on the curve.
A 'roc' object from the 'pROC' package, containing the ROC curve and AUC information.
Edi Prifti (IRD)
## Not run:
# Assuming `score` is a vector of predicted scores and `y` is the true labels
plotAUC(score, y, main = "ROC Curve with AUC", ci = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.