Sorts observations by predicted score and plots the cumulative share of
positives captured against the share of the population targeted — the
standard way to size a marketing or triage cutoff.
geom_lift_gain(
mapping = NULL,
data = NULL,
type = "gain",
color = NULL,
baseline = TRUE
)
Arguments
- mapping, data
Standard layer overrides. Map the score to score
and the binary outcome to truth.
- type
"gain" (cumulative captured) or "lift" (ratio to random).
- color
Curve color.
- baseline
Draw the random-targeting reference.
Value
A Layer to add with +.
Examples
set.seed(1)
s <- runif(200)
d <- data.frame(score = s, y = rbinom(200, 1, s))
ggnext(d, aes(score = score, truth = y)) + geom_lift_gain()
#> <ggnext plot>
#> data: 200 x 2
#> aes: score = score, truth = y
#> layers: 1
#> coord: cartesian
#> mode: static