Gini: Gini index for a given split of a categorical variable

View source: R/Gini.R

GiniR Documentation

Gini index for a given split of a categorical variable

Description

Calculates the Gini index of a categorical variable for a given split (threshold) value of a numeric variable.

Usage

Gini(x, group, thres)

Arguments

x

A numeric vector

group

Categorical variable

thres

Threshold value to use for the split

Value

A data frame with Gini index before and after the split, as well as the gain and gain percent

References

Kuhn, M. & Johnson, K. (2013). Applied Predictive Modeling. Springer.

Witten, I. H., Frank, E. & Hall, M. A. (2011). Data Mining: Practical Machine Learning Tools and Techniques. Elsevier.

Examples

Gini(mtcars$mpg, mtcars$cyl, 15)
Gini(mtcars$mpg, mtcars$cyl, 21)
Gini(mtcars$mpg, mtcars$cyl, 25)


maxgav13/GMisc documentation built on June 12, 2022, 3:48 a.m.