knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
library(risk3r) library(scorecard) library(dplyr) library(ggplot2) theme_set( theme_minimal(base_size = 21) + theme(axis.text.x = element_text(angle = 45, hjust = 1)) ) if(require(showtext)){ sysfonts::font_add_google("IBM Plex Sans", "plex") showtext::showtext_auto() } data("germancredit")
woebin_summary
bins <- woebin(germancredit, y = "creditability") binssummary <- woebin_summary(bins) binssummary binssummary %>% select(variable, ks, iv, iv_lbl, hhi, hhi_lbl, distribution)
woebin_ply_min
The woebin_ply_min
function don't need a data frame argument.
variable <- head(germancredit$credit.amount, 6) bin <- bins$credit.amount bin woebin_ply_min(variable, bin) woebin_ply_min(variable, bin, value = "posprob")
woebin_cor_iv
datcor <- woebin_cor_iv(germancredit, bins) datcor cor_limit <- 0.15 datcor %>% filter(var1 != var2) %>% mutate( cor_conflict = ifelse(abs(r) > cor_limit, TRUE, FALSE), variable_to_remove = ifelse( cor_conflict, ifelse(var1 > var2, var2, var1), NA ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.