Learn R Programming

caret (version 4.42)

aucRoc: Compute the area under an ROC curve

Description

This function uses the trapezoidal rule to calculate the area. If the area is less than .5, then 1 - area is used.

Usage

aucRoc(object)

Arguments

object
object from the roc function or a matrix/data frame with columns named "sensitivity" and "specificity"

Value

  • a scalar number

See Also

sensitivity, specificity, roc

Examples

Run this code
set.seed(6)
testData <- data.frame(
                       x = c(rnorm(200), rnorm(200) + 1),
                       group = factor(rep(letters[1:2], each = 200)))

densityplot(~testData$x,
            groups = testData$group,
            auto.key = TRUE)   

rocValues <- roc(testData$x, testData$group)
aucRoc(rocValues)

Run the code above in your browser using DataLab