View source: R/23_ENSEMBLE_BLOCKS.R
ensemble.blocks | R Documentation |
ensemble.blocks
performs blockwise regression where the predictions of each blocks' model are
integrated into a final model. The final model is estimated in the form of logistic regression without
any check of the estimated coefficients (e.g. statistical significance or sign of the estimated coefficients).
ensemble.blocks(
method,
target,
db,
coding = "WoE",
blocks,
p.value = 0.05,
miv.threshold = 0.02,
m.ch.p.val = 0.05
)
method |
Regression method applied on each block.
Available methods: |
target |
Name of target variable within |
db |
Modeling data with risk factors and target variable. |
coding |
Type of risk factor coding within the model. Available options are: |
blocks |
Data frame with defined risk factor groups. It has to contain the following columns: |
p.value |
Significance level of p-value for the estimated coefficient. For |
miv.threshold |
MIV (marginal information value) entrance threshold applicable only for code"stepMIV" method. Only the risk factors with MIV higher than the threshold are candidate for the new model. Additional criteria is that MIV value should significantly separate good from bad cases measured by marginal chi-square test. |
m.ch.p.val |
Significance level of p-value for marginal chi-square test applicable only for code"stepMIV" method. This test additionally supports MIV value of candidate risk factor for final decision. |
The command embeded.blocks
returns a list of three objects.
The first object (model
) is the list of the models of each block (an object of class inheriting from "glm"
).
The second object (steps
), is the data frame with risk factors selected from the each block.
The third object (dev.db
), returns the list of block's model development databases.
Anderson, R.A. (2021). Credit Intelligence & Modelling, Many Paths through the Forest of Credit Rating and Scoring, OUP Oxford
staged.blocks
, embedded.blocks
, stepMIV
, stepFWD
,
stepRPC
, stepFWDr
and stepRPCr
.
suppressMessages(library(PDtoolkit))
data(loans)
#create risk factor priority groups
rf.all <- names(loans)[-1]
set.seed(22)
blocks <- data.frame(rf = rf.all, block = sample(1:3, length(rf.all), rep = TRUE))
blocks <- blocks[order(blocks$block), ]
blocks
#method: stepRPCr
res <- ensemble.blocks(method = "stepRPCr",
target = "Creditability",
db = loans,
blocks = blocks,
p.value = 0.05)
names(res)
nb <- length(res[["models"]])
res$models[[nb]]
auc.model(predictions = predict(res$models[[nb]], type = "response",
newdata = res$dev.db[[nb]]),
observed = res$dev.db[[nb]]$Creditability)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.