Comments (1)
library(rbin)
# equal frequency binning
bins <- rbin_equal_freq(mbank, y, age, 10)
bins
#> Binning Summary
#> ------------------------------------
#> Method Equal Frequency
#> Response y
#> Predictor age
#> Bins 10
#> Count 4521
#> Goods 517
#> Bads 4004
#> Entropy 0.5
#> Information Value 0.11
#>
#>
#> lower_cut upper_cut bin_count good bad good_rate woe iv
#> 1 18 29 452 77 375 0.17035398 -0.46388566 2.564352e-02
#> 2 29 31 452 53 399 0.11725664 -0.02833676 8.116094e-05
#> 3 31 34 452 44 408 0.09734513 0.18007127 3.023706e-03
#> 4 34 36 452 45 407 0.09955752 0.15514443 2.266308e-03
#> 5 36 39 452 47 405 0.10398230 0.10673320 1.092922e-03
#> 6 39 42 452 37 415 0.08185841 0.37035434 1.188083e-02
#> 7 42 46 452 43 409 0.09513274 0.20550877 3.899674e-03
#> 8 46 51 452 34 418 0.07522124 0.46211464 1.785222e-02
#> 9 51 56 452 50 402 0.11061947 0.03742282 1.380079e-04
#> 10 56 84 453 87 366 0.19205298 -0.61028105 4.691227e-02
#> entropy
#> 1 0.6585139
#> 2 0.5214234
#> 3 0.4605229
#> 4 0.4675914
#> 5 0.4814936
#> 6 0.4086938
#> 7 0.4533741
#> 8 0.3851129
#> 9 0.5017816
#> 10 0.7057464
# plot
plot(bins)
# bins
bins$bins
#> lower_cut upper_cut bin bin_count good bad bin_cum_count good_cum_count
#> 1 18 29 1 452 77 375 452 77
#> 2 29 31 2 452 53 399 904 130
#> 3 31 34 3 452 44 408 1356 174
#> 4 34 36 4 452 45 407 1808 219
#> 5 36 39 5 452 47 405 2260 266
#> 6 39 42 6 452 37 415 2712 303
#> 7 42 46 7 452 43 409 3164 346
#> 8 46 51 8 452 34 418 3616 380
#> 9 51 56 9 452 50 402 4068 430
#> 10 56 84 10 453 87 366 4521 517
#> bad_cum_count bin_prop good_rate bad_rate good_dist bad_dist
#> 1 375 0.09997788 0.17035398 0.8296460 0.14893617 0.09365634
#> 2 774 0.09997788 0.11725664 0.8827434 0.10251451 0.09965035
#> 3 1182 0.09997788 0.09734513 0.9026549 0.08510638 0.10189810
#> 4 1589 0.09997788 0.09955752 0.9004425 0.08704062 0.10164835
#> 5 1994 0.09997788 0.10398230 0.8960177 0.09090909 0.10114885
#> 6 2409 0.09997788 0.08185841 0.9181416 0.07156673 0.10364635
#> 7 2818 0.09997788 0.09513274 0.9048673 0.08317215 0.10214785
#> 8 3236 0.09997788 0.07522124 0.9247788 0.06576402 0.10439560
#> 9 3638 0.09997788 0.11061947 0.8893805 0.09671180 0.10039960
#> 10 4004 0.10019907 0.19205298 0.8079470 0.16827853 0.09140859
#> woe dist_diff iv entropy prop_entropy
#> 1 -0.46388566 -0.055279827 2.564352e-02 0.6585139 0.06583682
#> 2 -0.02833676 -0.002864157 8.116094e-05 0.5214234 0.05213081
#> 3 0.18007127 0.016791719 3.023706e-03 0.4605229 0.04604211
#> 4 0.15514443 0.014607733 2.266308e-03 0.4675914 0.04674880
#> 5 0.10673320 0.010239760 1.092922e-03 0.4814936 0.04813871
#> 6 0.37035434 0.032079623 1.188083e-02 0.4086938 0.04086034
#> 7 0.20550877 0.018975705 3.899674e-03 0.4533741 0.04532738
#> 8 0.46211464 0.038631581 1.785222e-02 0.3851129 0.03850277
#> 9 0.03742282 0.003687802 1.380079e-04 0.5017816 0.05016707
#> 10 -0.61028105 -0.076869939 4.691227e-02 0.7057464 0.07071514
Created on 2023-06-02 by the reprex package (v0.3.0)
from rbin.
Related Issues (20)
- 0.1.0 Checklist
- Return entropy
- Select data from RStudio
- Bin multiple variables
- Save binned data as RDS
- Use rlang for errors and warnings
- Use \donttest
- Do not write files
- Forthcoming release of ggplot2 and rbin
- Force decreasing trend
- Force increasing trend
- Error: Argument 2 must be length 3, not 2 HOT 7
- Option to return plot object
- Import shiny app from xplorerr
- 0.1.2 Release Checklist
- Flexible intervals
- Visual binning
- 0.2.0 Checklist
- Incorrect package alias
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rbin.