WOEProfet: WOE Transformation

Description Usage Arguments Details Value Examples

View source: R/Rprofet.R

Description

Function that calculates the WOE for each bin and the information value for each variable.

Usage

1
WOEProfet(dat, id, target, varcol)

Arguments

dat

Dataframe of binned variables.

id

ID variable.

target

A binary target variable.

varcol

Vector of variables to have WOE transformation.

Details

The id and the target variables must be provided. The target variable must be a numeric binary variable.

Value

A list with the following components.

BinWOE

Dataframe with the binned variables and their WOE values.

WOE

Dataframe with the WOE values.

IV

Each attribute and their associated information values.

vars

A list containing the different WOE values for each attribute.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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)

head(WOE_dat$BinWOE)
head(WOE_dat$WOE)
WOE_dat$IV
head(WOE_dat$vars$income)

Rprofet documentation built on April 1, 2020, 5:11 p.m.

Related to WOEProfet in Rprofet...