knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

creditscore

License: MIT

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:

  1. bin_manual, c_l, c_r - Used to bin numeric variables
  2. fit_logit - For taking data to fit into a logit model
  3. scale_manual, scale_double - Scaling the scorecard models to a 400+ number system or as specified by the user

The 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.

Installation

You can install the development version of creditscore from the Github repo with:

devtools::install_github("jgendrinal/creditscore")

Example

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)


jgendrinal/creditscore documentation built on May 30, 2020, 3:51 p.m.