aucC_wrap: Quick computation of the AUC

View source: R/auc.R

aucC_wrapR Documentation

Quick computation of the AUC

Description

Scores represent a prediction of how likely a label corresponds to a targeted value. The targeted value defaults to "Yes", but these may be easily changed by passing in an appropriate character vector of levels, where the targeted category is the second level.

Usage

aucC_wrap(label, scores, levels = c("No", "Yes"))

Arguments

label

A factor vector with levels of c("No","Yes") in any order, or a character vector taking the same values.

scores

A numeric vector of the same length above. Higher scores must correspond to the "Yes" level of the labels.

levels

A character vector of length at least two, corresponding to the unique values possible in label. The targeted level is the one presented in the second position: e.g. levels = c("No","Yes") corresponds to a targeted level of "Yes".

Value

The AUC, defined as the area under the ROC curve computed using label and scores.

Examples

## Not run: 
y=rbinom(100, size=1, prob=1/2)
label = factor(y, levels=c(0,1), labels=c("No", "Yes"))
scores = runif(100) # higher scores predict label == "Yes"
aucC::aucC_wrap(label=label, scores=scores)

label2 = factor(y, levels=c(0,1), labels=c("Apple", "Orange"))
aucC_wrap(label=label, scores=scores, labels=c("Apple", "Orange"))

## End(Not run)

jmiahjones/aucC documentation built on April 20, 2022, 12:46 a.m.