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 (int) is required. Name of y must not have a dot.

x

A factor variable with at least 2 different values. Value Inf is not allowed.

groups

Specifies customized groups created by the user. Name of x must not have a dot.

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

[Package smbinning version 0.9 Index]