# auc-methods: Methods for Function 'auc' in Package 'HandTill2001' In HandTill2001: Multiple Class Area under ROC Curve

## Description

Calculate area under curve of the receiver operating characteristic for two or more prediction classes.

## Usage

 ```1 2 3 4 5``` ```## S4 method for signature 'bincap' auc(object) ## S4 method for signature 'multcap' auc(object) ```

## Arguments

 `object` An object of `class` bincap or multcap.

## Details

Depending on whether `object` is of class `bincap` or of class `multcap`, a binary class or multiple class AUC is calculated.

## Value

An object of class `"numeric"`.

## Methods

signature(object = "bincap")

calculates the AUC statistic for a binary class response following Hand and Till (2001), Eq. (3).

signature(object = "multcap")

calculates the AUC statistic for a multiple class response following Hand and Till (2001), Eq. (7).

## References

David J. Hand and Robert J. Till (2001). A Simple Generalisation of the Area Under the ROC Curve for Multiple Class Classification Problems. Machine Learning 45(2), p. 171–186. DOI: 10.1023/A:1010920819831.

`class?bincap`, `class?multcap`

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25``` ```data(ht01.twoclass, package = "HandTill2001") message(" == AUC for a binary class response") message(" == == HandTill2001 result:") HandTill2001::auc(HandTill2001::bincap( response = as.factor(ht01.twoclass[["observed"]]), predicted = ht01.twoclass[["predicted"]], true = "1" )) ## Not run: message(" == == ROCR result:") ROCR::performance(ROCR::prediction( labels = ht01.twoclass[["observed"]], predictions = ht01.twoclass[["predicted"]] ), measure = "auc" )@y.values ## End(Not run) data(ht01.multipleclass, package = "HandTill2001") message(" == AUC for a multiple class response") predicted <- as.matrix(ht01.multipleclass[, levels(ht01.multipleclass[["observed"]])]) HandTill2001::auc(HandTill2001::multcap( response = ht01.multipleclass[["observed"]], predicted = predicted )) ```

### Example output

``` == AUC for a binary class response
== == HandTill2001 result:
 0.8026076
== == ROCR result:
[]
 0.8026076

== AUC for a multiple class response
 0.9472118
```

HandTill2001 documentation built on Nov. 2, 2020, 5:07 p.m.