Learn R Programming

HandTill2001 (version 0.2-4)

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.

Arguments

Value

  • An object of class "numeric".

Details

Depending on whether object is of class "bincap" or of class "multcap", a two 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: http://dx.doi.org/10.1023/A:1010920819831{10.1023/A:1010920819831}.

See Also

"class?bincap", "class?multcap"

Examples

Run this code
library(HandTill2001)
data(ht01.twoclass)
data(ht01.multipleclass)
message("== AUC for a two class response")
message(" == == ROCR result:")
library(ROCR)
performance(prediction(labels=ht01.twoclass$observed
                       , predictions=ht01.twoclass$predicted
                       )
            , measure = "auc")
message("== == ht01 result:")
auc(bincap(
	    response = as.factor(ht01.twoclass$observed)
	    , predicted = ht01.twoclass$predicted
	    , true = "1"
	    ))
message("== AUC for a multiple class response")
auc(multcap(
	     response = ht01.multipleclass$observed
	     , predicted = as.matrix(ht01.multipleclass[, levels(ht01.multipleclass$observed)])
	     ))

Run the code above in your browser using DataLab