woebin_plot: WOE Binning Visualization

Description Usage Arguments Value See Also Examples

Description

woebin_plot create plots of count distribution and bad probability for each bin. The binning informations are generates by woebin.

Usage

1
2
woebin_plot(bins, x = NULL, title = NULL, show_iv = TRUE,
  line_value = "badprob", ...)

Arguments

bins

A list of data frames. Binning information generated by woebin.

x

Name of x variables. Defaults to NULL. If x is NULL, then all columns except y are counted as x variables.

title

String added to the plot title. Defaults to NULL.

show_iv

Logical. Defaults to TRUE, which means show information value in the plot title.

line_value

The value displayed as line. Accepted values are 'badprob' and 'woe'. Defaults to bad probability.

...

Additional parameters

Value

A list of binning graphics.

See Also

woebin, woebin_ply, woebin_adj

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Load German credit data
data(germancredit)

# Example I
bins1 = woebin(germancredit, y="creditability", x="credit.amount")

p1 = woebin_plot(bins1)
print(p1)

# modify line value
p1_w = woebin_plot(bins1, line_value = 'woe')
print(p1_w)

# modify colors
p1_c = woebin_plot(bins1, line_color='#FC8D59', bar_color=c('#FFFFBF', '#99D594'))
print(p1_c)

# show iv, line value, bar value
p1_iv = woebin_plot(bins1, show_iv = FALSE)
print(p1_iv)
p1_lineval = woebin_plot(bins1, show_lineval = FALSE)
print(p1_lineval)
p1_barval  = woebin_plot(bins1, show_barval = FALSE)
print(p1_barval)


# Example II
bins = woebin(germancredit, y="creditability")
plotlist = woebin_plot(bins)
print(plotlist$credit.amount)

# # save binning plot
# for (i in 1:length(plotlist)) {
#   ggplot2::ggsave(
#      paste0(names(plotlist[i]), ".png"), plotlist[[i]],
#      width = 15, height = 9, units="cm" )
#   }

scorecard documentation built on Aug. 30, 2020, 5:06 p.m.