knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of creditscore is to create tidy workflows for credit scorecard modelling. Verbs used in this package make it easier to understand how the models were built. Use of the pipe (%>%
) allows the user to code models step-by-step. A final utility function allows the user to score borrowers given a credit scorecard model.
The creditscore model development framework has three main function groups:
bin_manual
, c_l
, c_r
- Used to bin numeric variables fit_logit
- For taking data to fit into a logit model scale_manual
, scale_double
- Scaling the scorecard models to a 400+ number system or as specified by the userThe result of the workflow is a glm model object containing the scorecard model.
Finally, the utility function score_credit
is the function that scores borrowers given their information and the model just created.
You can install the development version of creditscore from the Github repo with:
devtools::install_github("jgendrinal/creditscore")
This is a basic example which shows you how to solve a common problem:
library(creditscore) library(dplyr)
# Create scorecard model - with scaling card_model_scaled <- bin_manual(german, bad, duration = c_r(15, 32)) %>% fit_logit(bad ~ duration + age + employed_since) %>% scale_double_odds(odds_fifty = 600, pdo = 20) # Without scaling card_model_noscale <- bin_manual(german, bad, duration = c_r(15, 32)) %>% fit_logit(bad ~ duration + age + employed_since)
Now that we've built our models, let's see how they perform:
score_credit(slice(german, 1:30), card_model_scaled)
score_credit(slice(german, 1:30), card_model_noscale)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.