auc: Calculate the area under the curve of various plots including...

View source: R/auc.R

aucR Documentation

Calculate the area under the curve of various plots including the receiver operating characteristic and precision-recall curve.

Description

Calculate the area under the curve of various plots including the receiver operating characteristic and precision-recall curve.

Usage

auc(preds, obs, curve = c("roc", "pr"), max_intervals = 1000)

Arguments

preds

A vector of predicted probabilities.

obs

A vector containing the observed binary outcomes (0 or 1).

curve

= c('roc', 'pr')

max_intervals

The maximum number of thresholds to evaluate. Default = 1000.

Value

A named vector with the area under the curve of a specified plot.

Examples

# Generate some predictions
predictions <- runif(1000)
# Generate some binary outcomes
observations <- sample(0:1, size = 1000, replace = TRUE)
# Calculate the AUC ROC
auc(predictions, observations, curve = 'roc')

gweissman/gmish documentation built on Feb. 21, 2025, 1:20 a.m.