Learn R Programming

cvAUC (version 1.1.4)

AUC: Area Under the ROC Curve

Description

This function calculates Area Under the ROC Curve (AUC). The AUC can be defined as the probability that the fit model will score a randomly drawn positive sample higher than a randomly drawn negative sample. This is also equal to the value of the Wilcoxon-Mann-Whitney statistic. This function is a wrapper for functions from the ROCR package.

Usage

AUC(predictions, labels, label.ordering = NULL)

Arguments

predictions

A vector of predictions, or predicted probabilities, for each observation.

labels

A binary vector containing the true values for each observation. Must have the same length as predictions.

label.ordering

The default ordering of the classes can be changed by supplying a vector containing the negative and the positive class label (negative label first, positive label second).

Value

The value returned is the Area Under the ROC Curve (AUC).

References

References to the underlying ROCR code, used to calculate area under the ROC curve, can be found on the ROCR homepage at: https://ipa-tys.github.io/ROCR/

See Also

prediction, performance, cvAUC, ci.cvAUC, ci.pooled.cvAUC

Examples

Run this code
# NOT RUN {
library(cvAUC)
library(ROCR)  #load example data

data(ROCR.simple)
auc <- AUC(ROCR.simple$predictions, ROCR.simple$labels)
# [1] 0.8341875

# }

Run the code above in your browser using DataLab