Description Usage Arguments Value See Also Examples
gainsChart
produces a gains chart table, evaluating
y
as the dependent variable and yhat
as the vector of predicted values.
When yhat
is a combined model score, use y2
to supply the other
dependent variable. Users may specify the number of bins (i.e. 10 for deciles) that are desired.
1 | gainsChart(y, yhat, y2 = NULL, numBins = 10)
|
y |
logical, integer or numeric vector (dependent variable) |
yhat |
numeric vector (predicted values of |
y2 |
logical, integer or numeric vector (other dependent variable for combined models) |
numBins |
integer value >= 2; number of desired bins |
A data frame with class "mt_gainsChart
" containing the
following columns:
yhatBin
: integer specifying the bin number (i.e. decile)
minYhat
: minimum value of yhat
maxYhat
: maximum value of yhat
Freq
: number of observations (relative)
cumFreq
: number of observations (cumulative)
sumY
: sum of y
values (relative)
sumYB
(combined only): sum of y
(binary) values (relative)
avgY
: average of y
values (relative)
avgYB
(combined only): average of y
(binary) values (relative)
Lift
: lift of avgY
(relative)
LiftYB
(combined only): lift of avgYB
(relative)
sumYC
(combined only): sum of y
(continuous) values (relative)
avgYC
(combined only): average of y
(continuous) values (relative)
LiftYC
(combined only): lift of avgYC
(relative)
perFreqYC
(combined only): average (per Freq) of y
(continuous) values (relative)
LiftYC2
(combined only): lift of perFreqYC
(relative)
cumSumY
: sum of y
values (cumulative)
cumSumYC
(combined only): sum of y
(continuous) values (cumulative)
cumAvgY
: average of y
values (cumulative)
cumLift
: lift of avgY
(cumulative)
cumPctY
: percentage of y
values (cumulative)
cumPctYC
(combined only): percentage of y
(continuous) values (cumulative)
nonY
(binary only): sum of non-y
values (relative)
cumNonY
(binary only): sum of non-y
values (cumulative)
cumPctNonY
(binary only): percentage of non-y
values (cumulative)
cumPctRandom
(continuous & combined): uniform random percentage (cumulative)
KS
: K-S statistic
1 2 3 4 5 6 7 8 9 10 | # pull in sample scored data frame
x <- modelSampleScored
# filter to validation subset
x <- x[x$ValidateFlag, ]
# gains chart binary
gainsChart(x$TargetFlag, x$pTargetFlag)
# gains chart continuous
gainsChart(x[x$TargetFlag, "TargetValue"], x[x$TargetFlag, "pTargetValue"])
# gains chart combined
gainsChart(x$TargetFlag, x$pTargetFlag*x$pTargetValue, x$TargetValue)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.