woe.tbl {PDtoolkit} | R Documentation |
Weights of evidence (WoE) table
Description
woe.tbl
calculates WoE and information value for given target variable and risk factor along with
accompanied metrics needed for their calculation.
WoE table reports:
bin: Risk factor group (bin).
no: Number of observations per bin.
ng: Number of good cases (where target is equal to 0) per bin.
nb: Number of bad cases (where target is equal to 1) per bin.
pct.o: Percentage of observations per bin.
pct.g: Percentage of good cases (where target is equal to 0) per bin.
pct.b: Percentage of bad cases (where target is equal to 1) per bin.
dr: Default rate per bin.
so: Number of all observations.
sg: Number of all good cases.
sb: Number of all bad cases.
dist.g: Distribution of good cases per bin.
dist.b: Distribution of bad cases per bin.
woe: WoE value.
iv.b: Information value per bin.
iv.s: Information value of risk factor (sum of individual bins' information values).
Usage
woe.tbl(tbl, x, y, y.check = TRUE)
Arguments
tbl |
Data frame which contains target variable ( |
x |
Selected risk factor. |
y |
Selected target variable. |
y.check |
Logical, if target variable ( |
Value
The command woe.tbl
returns the data frame with WoE and information value calculations along with accompanied metrics.
See Also
bivariate
for automatic bivariate analysis.
Examples
suppressMessages(library(PDtoolkit))
data(gcd)
#categorize numeric risk factors
gcd$age.bin <- woe.bin(x = gcd$age, y = gcd$qual, y.type = "bina")[[2]]
#generate woe table
woe.tbl(tbl = gcd, x = "age.bin", y = "qual")