The strategy table and strategy curve
Repeating the calculations you did in the previous exercise for several acceptance rates, you can obtain a strategy table. This table can be a useful tool for banks, as they can give them a better insight to define an acceptance strategy.
You know how to compute a bad rate for a certain acceptance rate by now, so the function strategy_bank
was written and loaded into your workspace to speed things up. This function computes the cut-off and bad rate for the acceptance rates that are multiples of 5% (0%, 5%, 10%, …).
This exercise is part of the course
Credit Risk Modeling in R
Exercise instructions
- Have a look at the function
strategy_bank
. - The vector
predictions_cloglog
contains predicted probabilities of default using the cloglog model you used in chapter 2, the vectorpredictions_loss_matrix
contains the predicted probabilities of default using the pruned tree including a loss matrix (previously constructed in chapter 3). Apply functionstrategy_bank
to each of the prediction-vectors, assign the namestrategy_cloglog
andstrategy_loss_matrix
respectively. - The strategy tables can be obtained using the object names in combination with
$table
. - The strategy curves have been plotted for you. The strategy curve of the tree model shows pretty strange behavior. Because of the structure of classification trees, you might have a bigger chance for weird "jumps" here. Additionally, the tree with a loss matrix was a very big one, so this might be the result of overfitting!
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Have a look at the function strategy_bank
# Apply the function strategy_bank to both predictions_cloglog and predictions_loss_matrix
# Obtain the strategy tables for both prediction-vectors
# Plot the strategy functions
par(mfrow = c(1,2))
plot(strategy_cloglog$accept_rate, strategy_cloglog$bad_rate,
type = "l", xlab = "Acceptance rate", ylab = "Bad rate",
lwd = 2, main = "logistic regression")
plot(strategy_loss_matrix$accept_rate, strategy_loss_matrix$bad_rate,
type = "l", xlab = "Acceptance rate",
ylab = "Bad rate", lwd = 2, main = "tree")