View source: R/08_SCALED_SCORE.R
scaled.score | R Documentation |
scaled.score
performs scaling of the probabilities for a certain set up. User has to select
three parameters (score, odd, pdo
), while the probabilities (probs
) are usually
predictions of the final model.
scaled.score(probs, score = 600, odd = 50/1, pdo = 20)
probs |
Model predicted probabilities of default. |
score |
Specific score for selected odd (for argument |
odd |
Odd (good/bad) at specific score (for argument |
pdo |
Points for double the odds. Default is 20. |
The command scaled.score
returns a vector of scaled scores.
Siddiqi, N. (2012). Credit Risk Scorecards: Developing and Implementing Intelligent Credit Scoring, John Wiley & Sons, Inc.
suppressMessages(library(PDtoolkit))
data(loans)
#run stepFWD
res <- stepFWD(start.model = Creditability ~ 1,
p.value = 0.05,
coding = "WoE",
db = loans)
final.model <- res$model
summary(final.model)$coefficients
#overview of development data base
head(res$dev.db)
#predict probabilities using the final model
loans$probs <- predict(final.model, type = "response", newdata = res$dev.db)
#scale probabilities to scores
loans$score <- scaled.score(probs = loans$probs, score = 600, odd = 50/1, pdo = 20)
#check AUC of probabilities and score
auc.model(predictions = loans$probs, observed = loans$Creditability)
auc.model(predictions = loans$score, observed = ifelse(loans$Creditability == 0, 1, 0))
#note that higher score indicates lower probability of default
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.