cvAUC {cvAUC} R Documentation

## Cross-validated Area Under the ROC Curve (AUC)

### Description

This function calculates cross-validated area under the ROC curve (AUC) esimates. For each fold, the empirical AUC is calculated, and the mean of the fold AUCs is the cross-validated AUC estimate. The area under the ROC curve is equal to the probability that the classifier will score a randomly drawn positive sample higher than a randomly drawn negative sample. This function is a simple wrapper for the AUC functionality inside the ROCR package.

### Usage

cvAUC(predictions, labels, label.ordering = NULL, folds = NULL)


### Arguments

 predictions A vector, matrix, list, or data frame containing the predictions. labels A vector, matrix, list, or data frame containing the true class labels. Must have the same dimensions 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). folds If specified, this must be a vector of fold ids equal in length to predictions and labels, or a list of length V (for V-fold cross-validation) of vectors of indexes for the observations contained in each fold. The folds argument must only be specified if the predictions and labels arguments are vectors.

### Details

If predictions and labels are provided as vectors and folds is NULL, then this function will return AUC (not cross-validated). See the documentation for the prediction function in the ROCR package for details on the predictions, labels and label.ordering arguments.

### Value

 perf An object of class 'performance' from the ROCR package. Can be used to plot the ROC curve. fold.AUC A vector containing the AUC estimate for each fold. cvAUC Cross-validated area under the curve.

### Author(s)

Erin LeDell oss@ledell.org

### References

Tobias Sing, Oliver Sander, Niko Beerenwinkel, and Thomas Lengauer. ROCR: Visualizing classifier performance in R. Bioinformatics, 21(20):3940-3941, 2005.

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

### Examples

# Example of how to get CV AUC and plot the curve.
library(cvAUC)
out <- cvAUC(ROCR.xval$predictions, ROCR.xval$labels)
plot(out$perf, col = "grey82", lty = 3, main = "10-fold CV AUC") #Plot CV AUC plot(out$perf, col ="red", avg = "vertical", add = TRUE)
# of how to use the folds argument.