R: Area Under the Curve

auc {ModelMetrics} | R Documentation

## Area Under the Curve

### Description

Calculates the area under the curve for a binary classifcation model

### Usage

    auc(...)

    ## Default S3 method:
    auc(actual, predicted, ...)

    ## S3 method for class 'glm'
    auc(modelObject, ...)

    ## S3 method for class 'randomForest'
    auc(modelObject, ...)

    ## S3 method for class 'glmerMod'
    auc(modelObject, ...)

    ## S3 method for class 'gbm'
    auc(modelObject, ...)

    ## S3 method for class 'rpart'
    auc(modelObject, ...)

### Arguments

`...` | additional parameters to be passed the the s3 methods
`actual` | A vector of the labels. Can be `numeric, character, or factor`
`predicted` | A vector of predicted values
`modelObject` | the model object. Currently supported `glm, randomForest, glmerMod, gbm`

### Examples

    data(testDF)
    glmModel <- glm(y ~ ., data = testDF, family="binomial")
    Preds <- predict(glmModel, type = 'response')

    auc(testDF$y, Preds)
    # using s3 method for glm
    auc(glmModel)

[Package ModelMetrics version 1.2.2.2 Index]