gainsChart: Generate a gains chart

Description Usage Arguments Value See Also Examples

View source: R/gainsChart.R

Description

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.

Usage

1
gainsChart(y, yhat, y2 = NULL, numBins = 10)

Arguments

y

logical, integer or numeric vector (dependent variable)

yhat

numeric vector (predicted values of y)

y2

logical, integer or numeric vector (other dependent variable for combined models)

numBins

integer value >= 2; number of desired bins

Value

A data frame with class "mt_gainsChart" containing the following columns:

See Also

glm, lm

Examples

 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)

dnegrey/miscTools documentation built on May 3, 2019, 2:57 p.m.