# NOT RUN {
# load germancredit data
data("germancredit")
# filter variable via missing rate, iv, identical value rate
dt_sel = var_filter(germancredit, "creditability")
# woe binning ------
bins = woebin(dt_sel, "creditability")
dt_woe = woebin_ply(dt_sel, bins)
# glm ------
m1 = glm( creditability ~ ., family = binomial(), data = dt_woe)
# summary(m1)
# Select a formula-based model by AIC
m_step = step(m1, direction="both", trace=FALSE)
m2 = eval(m_step$call)
# summary(m2)
# predicted proability
dt_pred = predict(m2, type='response', dt_woe)
# performance ------
# Example I # only ks & auc values
perf_eva(dt_woe$creditability, dt_pred, show_plot=FALSE)
# Example II # ks & roc plot
perf_eva(dt_woe$creditability, dt_pred)
# Example III # ks, lift, roc & pr plot
perf_eva(dt_woe$creditability, dt_pred, type = c("ks","lift","roc","pr"))
# }
Run the code above in your browser using DataLab