auc-methods: Methods for Function 'auc' in Package 'HandTill2001'

auc-methodsR Documentation

Methods for Function auc in Package HandTill2001

Description

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

Usage

## 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: \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1023/A:1010920819831")}.

See Also

class?bincap, class?multcap

Examples

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
))

HandTill2001 documentation built on June 8, 2025, 1:31 p.m.