scorecard_ply calculates credit score using the results from scorecard.

scorecard_ply(dt, card, only_total_score = TRUE, print_step = 0L,
  replace_blank_na = TRUE, var_kp = NULL)

Arguments

dt

A data frame, which is the rriginal dataset for training model.

card

The scorecard generated from the function scorecard.

only_total_score

Logical, default is TRUE. If it is TRUE, then the output includes only total credit score; Otherwise, if it is FALSE, the output includes both total and each variable's credit score.

print_step

A non-negative integer. Default is 1. If print_step>0, print variable names by each print_step-th iteration. If print_step=0, no message is print.

replace_blank_na

Logical. Replace blank values with NA. Default is TRUE. This argument should be the same with woebin's.

var_kp

Name of force kept variables, such as id column. Default is NULL.

Value

A data frame in score values

See also

Examples

# load germancredit data data("germancredit") # filter variable via missing rate, iv, identical value rate dt_sel = var_filter(germancredit, "creditability")
#> [INFO] filtering variables ...
# woe binning ------ bins = woebin(dt_sel, "creditability")
#> [INFO] creating woe binning ...
dt_woe = woebin_ply(dt_sel, bins)
#> [INFO] converting into woe values ...
# glm ------ m = glm(creditability ~ ., family = binomial(), data = dt_woe) # summary(m) # Select a formula-based model by AIC m_step = step(m, direction="both", trace=FALSE) m = eval(m_step$call) # summary(m) # predicted proability # dt_pred = predict(m, type='response', dt_woe) # performace # ks & roc plot # perf_eva(dt_woe$creditability, dt_pred) # scorecard # Example I # creat a scorecard card = scorecard(bins, m) card2 = scorecard2(bins=bins, dt=germancredit, y='creditability', x=c("status.of.existing.checking.account", "duration.in.month", "credit.history", "purpose", "credit.amount", "savings.account.and.bonds", "present.employment.since", "installment.rate.in.percentage.of.disposable.income", "personal.status.and.sex", "other.debtors.or.guarantors", "property", "age.in.years", "other.installment.plans", "housing")) # credit score # Example I # only total score score1 = scorecard_ply(germancredit, card) # Example II # credit score for both total and each variable score2 = scorecard_ply(germancredit, card, only_total_score = F)