ROC-curves for comparison of tree-based models

It's time for you to repeat the previous exercises, now comparing the tree-based models. The pROC() is now loaded in your workspace. The PD-predictions for tree-based methods are stored in the objects

  • predictions_undersample
  • predictions_prior
  • predictions_loss_matrix
  • predictions_weights

This exercise is part of the course

Credit Risk Modeling in R

View Course

Exercise instructions

  • Construct the ROC-objects for the tree based methods using function roc(response, predictor).
  • Use the previously created objects to construct ROC-curves. To draw them all on one plot, use plot() for the first ROC-curve drawn (for ROC_undersample), and lines() for the other three models to the same plot. Use the col-argument to change the color of the curve of ROC_prior to blue, ROC_loss_matrix to red and ROC_weights to green.
  • To get a better idea of the performance of the ROC-curves, have a look at the AUC's using function auc().

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Construct the objects containing ROC-information
ROC_undersample <- 
ROC_prior <-
ROC_loss_matrix <- 
ROC_weights <- 

# Draw the ROC-curves in one plot

  

    

# Compute the AUCs