sc.merge {LGDtoolkit} | R Documentation |
Special case merging procedure
Description
sc.merge
performs procedure of merging special case bins with one from complete cases.
This procedure can be used not only for LGD model development, but also for PD and EAD, i.e. for
all models that have categorical risk factors.
Usage
sc.merge(x, y, sc = "SC", sc.merge = "closest", force.trend = "modalities")
Arguments
x |
Categorical risk factor. |
y |
Target variable. |
sc |
Vector of special case values. Default is set to |
sc.merge |
Merging method. Available options are: |
force.trend |
Defines how initial summary table will be ordered. Possible options are: |
Value
The command sc.merge
generates a list of two objects. The first object, data frame summary.tbl
presents a summary table of final binning, while x.trans
is a vector of recoded values.
Examples
library(monobin)
library(LGDtoolkit)
data(lgd.ds.c)
rf.03.bin.s <- sts.bin(x = lgd.ds.c$rf_03, y = lgd.ds.c$lgd)
rf.03.bin.s[[1]]
table(rf.03.bin.s[[2]])
lgd.ds.c$rf_03_bin <- rf.03.bin.s[[2]]
rf.03.bin.c <- sc.merge(x = lgd.ds.c$rf_03_bin,
y = lgd.ds.c$lgd,
sc = "SC",
sc.merge = "closest",
force.trend = "modalities")
str(rf.03.bin.c)
rf.03.bin.c[[1]]
table(rf.03.bin.c[[2]])