Learn R Programming

HandTill2001 (version 1.0.3)

auc-methods: 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 bincap
auc(object)

# S4 method for multcap auc(object)

Value

An object of class "numeric".

Arguments

object

An object of class bincap or multcap.

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

Details

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

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: tools:::Rd_expr_doi("10.1023/A:1010920819831").

See Also

class?bincap, class?multcap

Examples

Run this code
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"
))
if (FALSE) {
message(" == == ROCR result:")
ROCR::performance(ROCR::prediction(
  labels = ht01.twoclass[["observed"]],
  predictions = ht01.twoclass[["predicted"]]
),
measure = "auc"
)@y.values
}
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
))

Run the code above in your browser using DataLab