auc: Area Under the Curve

Description Usage Arguments Examples

View source: R/auc.R

Description

Calculates the area under the curve for a binary classifcation model

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
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

1
2
3
4
5
6
7
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)

JackStat/ModelMetrics documentation built on July 6, 2021, 9:48 a.m.