| smbinning.factor.custom {smbinning} | R Documentation |
Customized Binning on Factor Variables
Description
It gives the user the ability to combine categories and create new attributes for a given characteristic.
Once these new attribues are created in a list (called groups), the funtion generates a table for
the uniques values of a given factor variable.
Usage
smbinning.factor.custom(df, y, x, groups)
Arguments
df |
A data frame. |
y |
Binary response variable (0,1). Integer ( |
x |
A factor variable with at least 2 different values. Value |
groups |
Specifies customized groups created by the user.
Name of |
Value
The command smbinning.factor.custom generates an object containing the necessary information
and utilities for binning.
The user should save the output result so it can be used
with smbinning.plot, smbinning.sql, and smbinning.gen.factor.
Examples
# Load library and its dataset
library(smbinning) # Load package and its data
# Example: Customized binning for a factor variable
# Notation: Groups between double quotes
result=smbinning.factor.custom(
smbsimdf1,x="inc",
y="fgood",
c("'W01','W02'", # Group 1
"'W03','W04','W05'", # Group 2
"'W06','W07'", # Group 3
"'W08','W09','W10'")) # Group 4
result$ivtable