pool_bin {mob} | R Documentation |
Monotonic binning for the pool data
Description
The function pool_bin
implements the monotonic binning for the pool data
based on the generalized boosted model (GBM).
Usage
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
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)
[Package mob version 0.4.2 Index]