pROC (version 1.10.0)

multiclass.roc: Multi-class AUC

Description

This function builds builds multiple ROC curve to compute the multi-class AUC as defined by Hand and Till.

Usage

multiclass.roc(...)
# S3 method for formula
multiclass.roc(formula, data, ...)
# S3 method for default
multiclass.roc(response, predictor,
levels=base::levels(as.factor(response)), 
percent=FALSE, ...)

Arguments

response

a factor, numeric or character vector of responses, typically encoded with 0 (controls) and 1 (cases), as in roc.

predictor

a numeric vector, containing the value of each observation, as in roc.

formula

a formula of the type response~predictor.

data

a matrix or data.frame containing the variables in the formula. See model.frame for more details.

levels

the value of the response for controls and cases respectively. In contrast with levels argument to roc, all the levels are used and combined to compute the multiclass AUC.

percent

if the sensitivities, specificities and AUC must be given in percent (TRUE) or in fraction (FALSE, default).

...

further arguments passed to roc.

Value

A list of class “multiclass.roc” with the following fields:

auc

if called with auc=TRUE, a numeric of class “auc” as defined in auc. Note that this is not the standard AUC but the multi-class AUC as defined by Hand and Till.

ci

if called with ci=TRUE, a numeric of class “ci” as defined in ci.

response

the response vector as passed in argument. If NA values were removed, a na.action attribute similar to na.omit stores the row numbers.

predictor

the predictor vector as passed in argument. If NA values were removed, a na.action attribute similar to na.omit stores the row numbers.

levels

the levels of the response as defined in argument.

percent

if the sensitivities, specificities and AUC are reported in percent, as defined in argument.

call

how the function was called. See match.call for more details.

Warnings

If response is an ordered factor and one of the levels specified in levels is missing, a warning is issued and the level is ignored.

Details

This function performs multiclass AUC as defined by Hand and Till (2001). A multiclass AUC is a mean of auc and cannot be plotted.

This function has been much less tested than the rest of the package and is more subject to bugs. Please report them if you find one. Confidence intervals and comparison tests are not implemented yet.

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.

See Also

auc

Examples

Run this code
data(aSAH)

# Basic example
multiclass.roc(aSAH$gos6, aSAH$s100b)
# Produces an innocuous warning because one level has no observation

# Select only 3 of the aSAH$gos6 levels:
multiclass.roc(aSAH$gos6, aSAH$s100b, levels=c(3, 4, 5))

# Give the result in percent
multiclass.roc(aSAH$gos6, aSAH$s100b, percent=TRUE)



Run the code above in your browser using DataCamp Workspace