Description Usage Arguments Value Examples
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.
1 | smbinning.factor.custom(df, y, x, groups)
|
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 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 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
|
Loading required package: sqldf
Loading required package: gsubfn
Loading required package: proto
Loading required package: RSQLite
Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm
Loading required package: Formula
Warning message:
no DISPLAY variable so Tk is not available
Cutpoint CntRec CntGood CntBad CntCumRec CntCumGood CntCumBad PctRec
1 W01/W02 273 133 140 273 133 140 0.1092
2 W03/W04/W05 516 336 180 789 469 320 0.2064
3 W06/W07 502 428 74 1291 897 394 0.2008
4 W08/W09/W10 989 923 66 2280 1820 460 0.3956
5 Missing 220 180 40 2500 2000 500 0.0880
6 Total 2500 2000 500 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.4872 0.5128 0.9500 -0.0513 -1.4376 0.3069
2 0.6512 0.3488 1.8667 0.6242 -0.7621 0.1463
3 0.8526 0.1474 5.7838 1.7551 0.3688 0.0243
4 0.9333 0.0667 13.9848 2.6380 1.2517 0.4124
5 0.8182 0.1818 4.5000 1.5041 0.1178 0.0012
6 0.8000 0.2000 4.0000 1.3863 0.0000 0.8911
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.