Description Usage Arguments Value Examples
Function that fits a logistic regression models and scores points for each bin and calculates observations' total score.
1 2 3 4 5 6 7 8 9 10 | ScorecardProfet(
object,
target,
id,
varcol,
PDO = 100,
BaseOdds = 10,
BasePts = 1000,
reverse = FALSE
)
|
object |
A WOEProfet object containing dataframes with binned and WOE values. |
target |
A binary target variable. |
id |
ID variable. |
varcol |
Vector of WOE variables to be used in the logistic regression model. |
PDO |
Points to Double Odds. |
BaseOdds |
Base Odds. |
BasePts |
Base Points. |
reverse |
Logical. If true, higher points corresponds to a lower probability of being target. |
A list with the following components.
Scorecard |
The actual scorecard model. Table with the attribute bins and their corresponding WOE values and the points assigned to each bin. |
Results |
Dataframe with the bin, WOE value, and points assigned to each attribute and the total score for each observation. |
GLMSummary |
The summary of the logistic regression model fitted to build the scorecard. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | mydata <- ISLR::Default
mydata$ID = seq(1:nrow(mydata)) ## make the ID variable
mydata$default<-ifelse(mydata$default=="Yes",1,0) ## Creating numeric binary target variable
binned <- BinProfet(mydata, id= "ID", target= "default", num.bins = 5) ## Binning variables
WOE_dat <- WOEProfet(binned, "ID","default", 3:5) ## WOE transformation of bins
Score_dat <- ScorecardProfet(WOE_dat, target="default",
id= "ID", PDO = 50, BaseOdds = 10, BasePts = 1000, reverse = TRUE)
Score_dat$GLMSummary
head(Score_dat$Scorecard) ## Less points means more likely to default
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.