Description Usage Arguments Value Examples
It generates a table with relevant metrics for all the categories of a given factor variable.
1 | smbinning.factor(df, y, x, maxcat = 10)
|
df |
A data frame. |
y |
Binary response variable (0,1). Integer ( |
x |
A factor variable with at least 2 different values. Labesl with commas are not allowed. |
maxcat |
Specifies the maximum number of categories. Default value is 10.
Name of |
The command smbinning.factor
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.factor
.
1 2 3 4 5 6 | # Load library and its dataset
library(smbinning) # Load package and its data
# Binning a factor variable
result=smbinning.factor(smbsimdf1,x="inc",y="fgood", maxcat=11)
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' 144 72 72 144 72 72 0.0576
2 = 'W02' 129 61 68 273 133 140 0.0516
3 = 'W03' 186 133 53 459 266 193 0.0744
4 = 'W04' 167 115 52 626 381 245 0.0668
5 = 'W05' 163 88 75 789 469 320 0.0652
6 = 'W06' 264 230 34 1053 699 354 0.1056
7 = 'W07' 238 198 40 1291 897 394 0.0952
8 = 'W08' 368 353 15 1659 1250 409 0.1472
9 = 'W09' 336 312 24 1995 1562 433 0.1344
10 = 'W10' 285 258 27 2280 1820 460 0.1140
11 Missing 220 180 40 2500 2000 500 0.0880
12 Total 2500 2000 500 NA NA NA 1.0000
GoodRate BadRate Odds LnOdds WoE IV
1 0.5000 0.5000 1.0000 0.0000 -1.3863 0.1497
2 0.4729 0.5271 0.8971 -0.1086 -1.4949 0.1577
3 0.7151 0.2849 2.5094 0.9201 -0.4662 0.0184
4 0.6886 0.3114 2.2115 0.7937 -0.5926 0.0276
5 0.5399 0.4601 1.1733 0.1598 -1.2264 0.1300
6 0.8712 0.1288 6.7647 1.9117 0.5254 0.0247
7 0.8319 0.1681 4.9500 1.5994 0.2131 0.0040
8 0.9592 0.0408 23.5333 3.1584 1.7721 0.2596
9 0.9286 0.0714 13.0000 2.5649 1.1787 0.1273
10 0.9053 0.0947 9.5556 2.2571 0.8708 0.0653
11 0.8182 0.1818 4.5000 1.5041 0.1178 0.0012
12 0.8000 0.2000 4.0000 1.3863 0.0000 0.9655
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.