Learn R Programming

StatMeasures (version 1.0)

iv: Information value of an independent variable in predicting a binary response

Description

Takes in independent and dependent variable and returns IV value

Usage

iv(x, y)

Arguments

x
an independent variable
y
a binary response variable

Value

information value of x

Details

Information value of a variable is a significant indicator of its relevance in the prediction of a binary response variable. iv computes that value using the formula, IV = summation[(Responders - Non-responders)*ln(Responders / Non-responders) for each bin].

Ten bins are created for continous variables while categories itself are used as bins for categorical independent variables.

See Also

accuracy, auc, ks, splitdata

Examples

Run this code
# A 'data.frame'
df <- data.frame(x = c('a', 'a', 'a', 'b', 'b', 'b'),
                 y = c(0, 1, 0, 1, 0, 1))

# Information value
IV <- iv(x = df[, 'x'], y = df[, 'y'])

Run the code above in your browser using DataLab