Bin continuous data using the equal length binning method.

rbin_equal_length(data = NULL, response = NULL, predictor = NULL,
  bins = 10, include_na = TRUE)

# S3 method for rbin_equal_length
plot(x, ...)

Arguments

data

A data.frame or tibble.

response

Response variable.

predictor

Predictor variable.

bins

Number of bins.

include_na

logical; if TRUE, a separate bin is created for missing values.

x

An object of class rbin_equal_length.

...

further arguments passed to or from other methods.

Value

A tibble.

Examples

bins <- rbin_equal_length(mbank, y, age, 10) bins
#> Binning Summary #> --------------------------------- #> Method Equal Length #> Response y #> Predictor age #> Bins 10 #> Count 4521 #> Goods 517 #> Bads 4004 #> Entropy 0.5 #> Information Value 0.17 #> #> #> # A tibble: 10 x 7 #> cut_point bin_count good bad woe iv entropy #> <chr> <int> <int> <int> <dbl> <dbl> <dbl> #> 1 < 24.6 85 24 61 -1.11 0.0347 0.859 #> 2 < 31.2 822 106 716 -0.137 0.00358 0.555 #> 3 < 37.8 1133 115 1018 0.134 0.00425 0.474 #> 4 < 44.4 943 82 861 0.304 0.0172 0.426 #> 5 < 51 623 52 571 0.349 0.0147 0.414 #> 6 < 57.6 612 66 546 0.0660 0.000574 0.493 #> 7 < 64.2 229 43 186 -0.582 0.0214 0.697 #> 8 < 70.8 34 12 22 -1.44 0.0255 0.937 #> 9 < 77.4 25 13 12 -2.13 0.0471 0.999 #> 10 >= 77.4 15 4 11 -1.04 0.00517 0.837
# plot plot(bins)