scorecard: Creating a Scorecard

View source: R/scorecard.R

scorecardR Documentation

Creating a Scorecard

Description

scorecard creates a scorecard based on the results from woebin and glm.

Usage

scorecard(bins, model, points0 = 600, odds0 = 1/19, pdo = 50,
  basepoints_eq0 = FALSE, digits = 0)

Arguments

bins

Binning information generated from woebin function.

model

A glm model object.

points0

Target points, default 600.

odds0

Target odds, default 1/19. Odds = p/(1-p).

pdo

Points to Double the Odds, default 50.

basepoints_eq0

Logical, Defaults to FALSE. If it is TRUE, the basepoints will equally distribute to each variable.

digits

The number of digits after the decimal point for points calculation. Default 0.

Value

A list of scorecard data frames

See Also

scorecard2 scorecard_ply

Examples


# load germancredit data
data("germancredit")
# filter variable via missing rate, iv, identical value rate
dtvf = var_filter(germancredit, "creditability")
# split into train and test
dtlst = split_df(dtvf, y = 'creditability')
# binning
bins = woebin(dtlst$train, "creditability")

# to woe
dtlst_woe = lapply(dtlst, function(d) woebin_ply(d, bins))
# lr
m = glm(creditability ~ ., family = binomial(), data = dtlst_woe$train)
# scorecard
card = scorecard(bins, m)
prob = predict(m, dtlst_woe$train, type='response')
# problst = lapply(dtlst_woe, function(x) predict(m, x, type='response'))



scorecard documentation built on Aug. 8, 2023, 5:07 p.m.