smbinning.custom {smbinning}R Documentation

Customized Binning

Description

It gives the user the ability to create customized cutpoints.

Usage

smbinning.custom(df, y, x, cuts)

Arguments

df

A data frame.

y

Binary response variable (0,1). Integer (int) is required. Name of y must not have a dot. Name "default" is not allowed.

x

Continuous characteristic. At least 5 different values. Value Inf is not allowed. Name of x must not have a dot.

cuts

Vector with the cutpoints selected by the user. It does not have a default so user must define it.

Value

The command smbinning.custom generates and object containing the necessary info and utilities for binning. The user should save the output result so it can be used with smbinning.plot, smbinning.sql, and smbinning.gen.

Examples

# Load library and its dataset
library(smbinning) # Load package and its data

# Custom cutpoints using percentiles (20% each)
cbs1cuts=as.vector(quantile(smbsimdf1$cbs1, probs=seq(0,1,0.2), na.rm=TRUE)) # Quantiles
cbs1cuts=cbs1cuts[2:(length(cbs1cuts)-1)] # Remove first (min) and last (max) values

# Example: Customized binning
result=smbinning.custom(df=smbsimdf1,y="fgood",x="cbs1",cuts=cbs1cuts) # Run and save
result$ivtable # Tabulation and Information Value

[Package smbinning version 0.9 Index]