scaled.score: Scaling the probabilities

View source: R/08_SCALED_SCORE.R

scaled.scoreR Documentation

Scaling the probabilities

Description

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.

Usage

scaled.score(probs, score = 600, odd = 50/1, pdo = 20)

Arguments

probs

Model predicted probabilities of default.

score

Specific score for selected odd (for argument odd). Default is 600.

odd

Odd (good/bad) at specific score (for argument score). Default is 50/1.

pdo

Points for double the odds. Default is 20.

Value

The command scaled.score returns a vector of scaled scores.

References

Siddiqi, N. (2012). Credit Risk Scorecards: Developing and Implementing Intelligent Credit Scoring, John Wiley & Sons, Inc.

Examples

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

andrija-djurovic/PDtoolkit documentation built on Jan. 29, 2024, 9:35 a.m.