pool_bin: Monotonic binning for the pool data

Description Usage Arguments Value Examples

View source: R/pool_bin.R

Description

The function pool_bin implements the monotonic binning for the pool data based on the generalized boosted model (GBM).

Usage

1
pool_bin(x, num, den, log = FALSE)

Arguments

x

A numeric vector

num

A numeric vector with integer values for numerators to calculate bad rates

den

A numeric vector with integer values for denominators to calculate bad rates

log

A logical constant either TRUE or FALSE. The default is FALSE

Value

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
data(hmeq)
df <- rbind(Reduce(rbind, 
                   lapply(split(hmeq, floor(hmeq$CLAGE)),
                          function(d) data.frame(AGE = unique(floor(d$CLAGE)),
                                                 NUM = sum(d$BAD),
                                                 DEN = nrow(d)))),
            data.frame(AGE = NA, 
                       NUM = sum(hmeq[is.na(hmeq$CLAGE), ]$BAD),
                       DEN = nrow(hmeq[is.na(hmeq$CLAGE), ])))
pool_bin(df$AGE, df$NUM, df$DEN, log = TRUE) 

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

Related to pool_bin in mob...