kmn_bin: Monotonic binning based on k-means clustering

Description Usage Arguments Value Examples

View source: R/kmn_bin.R

Description

The function kmn_bin implements the monotonic binning based on the k-means clustering

Usage

1
kmn_bin(x, y)

Arguments

x

A numeric vector

y

A numeric vector with 0/1 binary values

Value

A list of binning outcomes, including a numeric vector with cut points and a dataframe with binning summary

Examples

1
2
data(hmeq)
kmn_bin(hmeq$DEROG, hmeq$BAD)

Example output

$cut
[1] 0 2 5

$tbl
  bin freq miss bads   rate     woe     iv    ks               rule
1   0  708  708   87 0.1229 -0.5760 0.0328  5.70         is.na($X$)
2   1 4527    0  754 0.1666 -0.2208 0.0346 21.37           $X$ <= 0
3   2  595    0  251 0.4218  1.0743 0.1493  7.47 $X$ > 0 & $X$ <= 2
4   3   96    0   68 0.7083  2.2767 0.1168  2.33 $X$ > 2 & $X$ <= 5
5   4   34    0   29 0.8529  3.1473 0.0735  0.00            $X$ > 5

mob documentation built on July 31, 2021, 9:06 a.m.

Related to kmn_bin in mob...