dx_auc: Calculate Area Under the ROC Curve (AUC)

View source: R/dx_metrics.R

dx_aucR Documentation

Calculate Area Under the ROC Curve (AUC)

Description

Calculates the Area Under the Receiver Operating Characteristic (ROC) Curve from prediction probabilities and true binary outcomes. AUC is a measure of the ability of a classifier to distinguish between classes and is used as a summary of the ROC curve.

Usage

dx_auc(truth, predprob, detail = "full")

Arguments

truth

Vector of true binary class outcomes (0 and 1).

predprob

Vector of prediction probabilities corresponding to the true outcomes.

detail

Character string specifying the level of detail in the output: "simple" for just the AUC value, "full" for the AUC value along with confidence intervals.

Value

Depending on the detail parameter, returns a single numeric value of AUC or a data frame with the AUC and its confidence intervals.

Examples

# Assuming you have a vector of true class labels and predicted probabilities
true_classes <- c(1, 0, 1, 1, 0, 0, 1)
predicted_probs <- c(0.9, 0.1, 0.8, 0.75, 0.33, 0.25, 0.67)
simple_auc <- dx_auc(true_classes, predicted_probs, detail = "simple")
detailed_auc <- dx_auc(true_classes, predicted_probs)
print(simple_auc)
print(detailed_auc)

overdodactyl/diagnosticSummary documentation built on Jan. 28, 2024, 10:07 a.m.