Created
April 21, 2019 20:58
-
-
Save statcompute/b3e377514e97fae14ea07b59383225a3 to your computer and use it in GitHub Desktop.
binning outcome with weights
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
derog_bin <- qtl_bin(df, bad, tot_derog) | |
derog_bin | |
#$df | |
# bin rule freq dist mv_cnt bad_freq bad_rate woe iv ks | |
# 00 is.na($X) 213 0.0365 213 70 0.3286 0.6416 0.0178 2.7716 | |
# 01 $X <= 1 3741 0.6409 0 560 0.1497 -0.3811 0.0828 18.9469 | |
# 02 $X > 1 & $X <= 2 478 0.0819 0 121 0.2531 0.2740 0.0066 16.5222 | |
# 03 $X > 2 & $X <= 4 587 0.1006 0 176 0.2998 0.5078 0.0298 10.6623 | |
# 04 $X > 4 818 0.1401 0 269 0.3289 0.6426 0.0685 0.0000 | |
# $cuts | |
# [1] 1 2 4 | |
wts_bin(derog_bin$df, c(1, 5)) | |
# bin rule wt_freq wt_dist wt_bads wt_badrate wt_woe wt_iv wt_ks | |
# 00 is.na($X) 493 0.0464 350 0.7099 0.6416 0.0178 2.7716 | |
# 01 $X <= 1 5981 0.5631 2800 0.4681 -0.3811 0.0828 18.9469 | |
# 02 $X > 1 & $X <= 2 962 0.0906 605 0.6289 0.2740 0.0066 16.5222 | |
# 03 $X > 2 & $X <= 4 1291 0.1216 880 0.6816 0.5078 0.0298 10.6623 | |
# 04 $X > 4 1894 0.1783 1345 0.7101 0.6426 0.0685 0.0000 | |
wts_bin(derog_bin$df, c(5, 1)) | |
# bin rule wt_freq wt_dist wt_bads wt_badrate wt_woe wt_iv wt_ks | |
# 00 is.na($X) 785 0.0322 70 0.0892 0.6416 0.0178 2.7716 | |
# 01 $X <= 1 16465 0.6748 560 0.0340 -0.3811 0.0828 18.9469 | |
# 02 $X > 1 & $X <= 2 1906 0.0781 121 0.0635 0.2740 0.0066 16.5222 | |
# 03 $X > 2 & $X <= 4 2231 0.0914 176 0.0789 0.5078 0.0298 10.6623 | |
# 04 $X > 4 3014 0.1235 269 0.0893 0.6426 0.0685 0.0000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment