gainsChartPerfCurve: Produce a cumulative performance graph based on gains...

Description Usage Arguments Value See Also Examples

View source: R/gainsChartPerfCurve.R

Description

gainsChartPerfCurve produces a cumulative performance graph based on a mt_gainsChart object. When two such objects are supplied, the function produces a combined graph, where the first object (xb) is labeled as "Build" and the second object (xv) is labeled as "Validate".

Usage

1
2
3
gainsChartPerfCurve(xb, xv = NULL, cb = "#009DDC", cv = "#77BF30",
  cr = "#666666", xLabel = "Cumulative Total Percent",
  yLabel = "Cumulative Outcome Percent")

Arguments

xb

mt_gainsChart object

xv

mt_gainsChart object

cb

character string; line color for xb (valid color)

cv

character string; line color for xv (valid color)

cr

character string; random/reference line color (valid color)

xLabel

character string; x-axis label

yLabel

character string; y-axis label

Value

A plot_ly visualization of a mt_gainsChart object, showing the cumulative percent of total Y (cumPctY for "binary"/"continuous"; cumPctYC for "combined") by quantile ( yhatBin) percent.

See Also

gainsChart, plot_ly

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# pull in sample scored data frame
x <- modelSampleScored
# filter to validation subset
x <- split(x, x$ValidateFlag)
# gains chart binary
y <- lapply(x, function(z){gainsChart(z$TargetFlag, z$pTargetFlag)})
# cumulative performance graph
gainsChartPerfCurve(y[[1]], y[[2]])
# gains chart continuous
y <- lapply(x, function(z){
    gainsChart(z[z$TargetFlag, "TargetValue"], z[z$TargetFlag, "pTargetValue"])
})
# cumulative performance graph
gainsChartPerfCurve(y[[1]], y[[2]])
# gains chart combined
y <- lapply(x, function(z){
    gainsChart(z$TargetFlag, z$pTargetFlag*z$pTargetValue, z$TargetValue)
})
# cumulative performance graph
gainsChartPerfCurve(y[[1]], y[[2]])

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