autobin: Automatic binning

Description Usage Arguments Value See Also Examples

View source: R/binning.R

Description

Automatic binning based on similarity in terms of proportions of non-default/default status between adjacent bins. autobin simply combines create_initial_bins and reduce_bins.

Usage

1
2
3
4
5
6
7
8
9
autobin(
  data,
  threshold,
  ordinal_value,
  default_ind,
  min_required_bins,
  confidence_level,
  ...
)

Arguments

data

The input data that contains ordinal_value and default_ind.

threshold

An integer that defines the minimum number of defaults in each bin. Typically needs a reasonable number of defaults to ensure the homogeneity test can be executed with some power.

ordinal_value

A numeric ordinal value that rank order each obligor's relative default risk. For example, a numeric score or numeric rating information.

default_ind

An integer, or double, representing the default status. The state of default must be indicated by 1 and non-default by 0.

min_required_bins

An integer (minimum two). The minimum number of bins in the returned list.

confidence_level

A double between 0 and 1 representing the confidence level passed onto the homogeneity test.

...

Optional parameters passed on to reduce_bins.

Value

A list of bins. Each list component in the returned list is a bin (of class bin).

See Also

See create_initial_bins, reduce_bins and merge_list_of_bins.

Examples

1
2
3
4
5
6
# example of automatic binning
autobins <- autobin(bin_data, 30, "score", "default", 7, 0.01)
bins_df <- dplyr::bind_rows(autobins)
plot(x = bins_df$mid_score, y = log(bins_df$odds), type = "p",
     col = "lightblue", cex = 1.5, pch = 20, ylab = "log(odds)",
     xlab = "score")

rrunner/binsmlr documentation built on July 19, 2020, 12:41 a.m.