Description Usage Arguments Value Examples
It gives the user the ability to impose a monotonic trend for good/bad rates per bin.
1 | smbinning.monotonic(df, y, x, p = 0.05)
|
df |
A data frame. |
y |
Binary response variable (0,1). Integer ( |
x |
Continuous characteristic. At least 5 different values. Value |
p |
Percentage of records per bin. Default 5% (0.05). |
The command smbinning.monotonic 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
# Example 1: Monotonic Binning (Increasing Good Rate per Bin)
smbinning(df=smbsimdf2,y="fgood2",x="chr2",p=0.05)$ivtable # Run regular binning
smbinning.monotonic(df=smbsimdf2,y="fgood2",x="chr2",p=0.05)$ivtable # Run monotonic binning
# Example 2: Monotonic Binning (Decreasing Good Rate per Bin)
smbinning(df=smbsimdf2,y="fgood3",x="chr3",p=0.05)$ivtable # Run regular binning
smbinning.monotonic(df=smbsimdf2,y="fgood3",x="chr3",p=0.05)$ivtable # Run monotonic binning
|
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 <= 30.1022 173 28 145 173 28 145 0.0692
2 <= 39.5405 290 127 163 463 155 308 0.1160
3 <= 44.9982 253 197 56 716 352 364 0.1012
4 <= 49.9464 296 58 238 1012 410 602 0.1184
5 <= 57.6759 449 412 37 1461 822 639 0.1796
6 <= 75.7161 638 622 16 2099 1444 655 0.2552
7 > 75.7161 125 63 62 2224 1507 717 0.0500
8 Missing 276 190 86 2500 1697 803 0.1104
9 Total 2500 1697 803 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.1618 0.8382 0.1931 -1.6445 -2.3928 0.3926
2 0.4379 0.5621 0.7791 -0.2496 -0.9978 0.1279
3 0.7787 0.2213 3.5179 1.2579 0.5096 0.0236
4 0.1959 0.8041 0.2437 -1.4118 -2.1601 0.5664
5 0.9176 0.0824 11.1351 2.4101 1.6618 0.3269
6 0.9749 0.0251 38.8750 3.6604 2.9121 1.0093
7 0.5040 0.4960 1.0161 0.0160 -0.7323 0.0294
8 0.6884 0.3116 2.2093 0.7927 0.0444 0.0002
9 0.6788 0.3212 2.1133 0.7483 0.0000 2.4763
Cutpoint CntRec CntGood CntBad CntCumRec CntCumGood CntCumBad PctRec
1 <= 30.1022 173 28 145 173 28 145 0.0692
2 <= 39.5405 290 127 163 463 155 308 0.1160
3 <= 49.9464 549 255 294 1012 410 602 0.2196
4 > 49.9464 1212 1097 115 2224 1507 717 0.4848
5 Missing 276 190 86 2500 1697 803 0.1104
6 Total 2500 1697 803 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.1618 0.8382 0.1931 -1.6445 -2.3928 0.3926
2 0.4379 0.5621 0.7791 -0.2496 -0.9978 0.1279
3 0.4645 0.5355 0.8673 -0.1423 -0.8906 0.1922
4 0.9051 0.0949 9.5391 2.2554 1.5071 0.7584
5 0.6884 0.3116 2.2093 0.7927 0.0444 0.0002
6 0.6788 0.3212 2.1133 0.7483 0.0000 1.4713
Cutpoint CntRec CntGood CntBad CntCumRec CntCumGood CntCumBad PctRec
1 <= 30.1022 173 145 28 173 145 28 0.0692
2 <= 39.5405 290 163 127 463 308 155 0.1160
3 <= 44.9982 253 56 197 716 364 352 0.1012
4 <= 49.9464 296 238 58 1012 602 410 0.1184
5 <= 57.6759 449 37 412 1461 639 822 0.1796
6 <= 75.7161 638 16 622 2099 655 1444 0.2552
7 > 75.7161 125 62 63 2224 717 1507 0.0500
8 Missing 276 86 190 2500 803 1697 0.1104
9 Total 2500 803 1697 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.8382 0.1618 5.1786 1.6445 2.3928 0.3926
2 0.5621 0.4379 1.2835 0.2496 0.9978 0.1279
3 0.2213 0.7787 0.2843 -1.2579 -0.5096 0.0236
4 0.8041 0.1959 4.1034 1.4118 2.1601 0.5664
5 0.0824 0.9176 0.0898 -2.4101 -1.6618 0.3269
6 0.0251 0.9749 0.0257 -3.6604 -2.9121 1.0093
7 0.4960 0.5040 0.9841 -0.0160 0.7323 0.0294
8 0.3116 0.6884 0.4526 -0.7927 -0.0444 0.0002
9 0.3212 0.6788 0.4732 -0.7483 0.0000 2.4763
Cutpoint CntRec CntGood CntBad CntCumRec CntCumGood CntCumBad PctRec
1 <= 30.1022 173 145 28 173 145 28 0.0692
2 <= 39.5405 290 163 127 463 308 155 0.1160
3 <= 49.9464 549 294 255 1012 602 410 0.2196
4 > 49.9464 1212 115 1097 2224 717 1507 0.4848
5 Missing 276 86 190 2500 803 1697 0.1104
6 Total 2500 803 1697 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.8382 0.1618 5.1786 1.6445 2.3928 0.3926
2 0.5621 0.4379 1.2835 0.2496 0.9978 0.1279
3 0.5355 0.4645 1.1529 0.1423 0.8906 0.1922
4 0.0949 0.9051 0.1048 -2.2554 -1.5071 0.7584
5 0.3116 0.6884 0.4526 -0.7927 -0.0444 0.0002
6 0.3212 0.6788 0.4732 -0.7483 0.0000 1.4713
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.