Learn R Programming

dlookr (version 0.3.9)

plot.optimal_bins: Visualize Distribution for an "optimal_bins" Object

Description

It generates plots for distribution, bad rate, and weight of evidence after running smbinning and saving its output.

See vignette("transformation") for an introduction to these concepts.

Usage

# S3 method for optimal_bins
plot(x, type = c("dist", "goodrate", "badrate",
  "WoE"), sub = "", ...)

Arguments

x

an object of class "optimal_bins", usually, a result of a call to binning_by().

type

options for visualization. Distribution ("dist"), Good Rate ("goodrate"), Bad Rate ("badrate"), and Weight of Evidence ("WoE").

sub

subtitle for the chart (optional).

...

arguments to be passed to methods, such as graphical parameters (see par). only applies to the first graph that is implemented with the boxplot() function.

See Also

binning_by, plot.bins, smbinning.plot.

Examples

Run this code
# NOT RUN {
# Generate data for the example
carseats <- ISLR::Carseats
carseats[sample(seq(NROW(carseats)), 20), "Income"] <- NA
carseats[sample(seq(NROW(carseats)), 5), "Urban"] <- NA

# optimal binning
bin <- binning_by(carseats, "US", "Advertising")
bin

# summary optimal_bins class
summary(bin)

# information value
attr(bin, "iv")

# information value table
attr(bin, "ivtable")

# visualize optimal_bins class
plot(bin, sub = "bins of Advertising variable")
# }

Run the code above in your browser using DataLab