Var_select {Rprofet}R Documentation

Select variables or filter variables by information value

Description

Function that selects specified variables or filters variables based on information value for WOEProfet object or WOE_StepAIC object.

Usage

Var_select(object, id, target, varcol, IVfilter)

Arguments

object

WOEProfet object.

id

ID variable.

target

A binary target variable.

varcol

Vector of variables to be selected or removed. Character or numeric.

IVfilter

Threshold of variables' Information Value.

Value

A list with the following components.

Bin

Dataframe with ID, Target, and selected binned variables.

WOE

Dataframe with ID, Target, and WOE values for selected binned variables.

IV

Information value of the selected binned variables.

vars

List containing a dataframe for each variable that consists of Bin, WOE, Target Rate, and observation count.

Examples

mydata <- ISLR::Default
mydata$ID = seq(1:nrow(mydata)) ## make the ID variable
mydata$default<-ifelse(mydata$default=="Yes",1,0) ## Creating numeric binary target variable
binned <- BinProfet(mydata, id= "ID", target= "default", num.bins = 5) ## Binning variables
WOE_dat <- WOEProfet(binned, "ID", "default", 3:5) ## WOEProfet object
WOE_dat$IV #IV item, the row index will be used for filtering variables
# To remove the income variable from the WOEProfet object
## Select the first two variables based on the IV item
subWOE1 <- Var_select(WOE_dat, id= "ID", target= "default", varcol= c(1,2))
##  Or remove the third variable based on the IV item
subWOE2 <- Var_select(WOE_dat, id= "ID", target= "default", varcol= -3)
## Filter the WOEProfet object based on variables' information values
subWOE3 <- Var_select(WOE_dat, id= "ID", target= "default", IVfilter = 0.05)

[Package Rprofet version 3.1.1 Index]