ModelMetrics (version 1.2.2)

gini: GINI Coefficient

Description

Calculates the GINI coefficient for a binary classifcation model

Usage

gini(...)

# S3 method for default gini(actual, predicted, ...)

# S3 method for glm gini(modelObject, ...)

# S3 method for randomForest gini(modelObject, ...)

# S3 method for glmerMod gini(modelObject, ...)

# S3 method for gbm gini(modelObject, ...)

# S3 method for rpart gini(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

Run this code
# NOT RUN {
data(testDF)
glmModel <- glm(y ~ ., data = testDF, family="binomial")
Preds <- predict(glmModel, type = 'response')

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

# }

Run the code above in your browser using DataLab