Description Usage Arguments Value Examples
It gives the user the ability to create customized cutpoints.
1 | smbinning.custom(df, y, x, cuts)
|
df |
A data frame. |
y |
Binary response variable (0,1). Integer ( |
x |
Continuous characteristic. At least 5 different values. Value |
cuts |
Vector with the cutpoints selected by the user. It does not have a default so user must define it. |
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.
1 2 3 4 5 6 7 8 9 10 | # 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
|
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 <= 41.954 449 285 164 449 285 164 0.1796
2 <= 49.366 449 335 114 898 620 278 0.1796
3 <= 55.588 448 359 89 1346 979 367 0.1792
4 <= 63.212 449 393 56 1795 1372 423 0.1796
5 > 63.212 449 423 26 2244 1795 449 0.1796
6 Missing 256 205 51 2500 2000 500 0.1024
7 Total 2500 2000 500 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.6347 0.3653 1.7378 0.5526 -0.8337 0.1547
2 0.7461 0.2539 2.9386 1.0779 -0.3084 0.0187
3 0.8013 0.1987 4.0337 1.3947 0.0084 0.0000
4 0.8753 0.1247 7.0179 1.9485 0.5622 0.0475
5 0.9421 0.0579 16.2692 2.7893 1.4030 0.2238
6 0.8008 0.1992 4.0196 1.3912 0.0049 0.0000
7 0.8000 0.2000 4.0000 1.3863 0.0000 0.4447
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.