Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign uplift chart in ggplot #656
lift chart in ggplot #656
Comments
|
Here is a temlate that I'll clean up for the next release: set.seed(1)
simulated <- data.frame(obs = factor(rep(letters[1:2], each = 100)),
perfect = sort(runif(200), decreasing = TRUE),
random = runif(200))
lift2 <- lift(obs ~ random + perfect, data = simulated)
xyplot(lift2, auto.key = list(columns = 2))
lines1 <- data.frame(x1 = 0, x2 = 100, y1 = 0, y2 = 100)
lines2 <- data.frame(x1 = 0, x2 = lift2$pct, y1 = 0, y2 = 100)
lines3 <- data.frame(x1 = lift2$pct, x2 = 100, y1 = 100, y2 = 100)
ggplot(lift2$data) +
geom_segment(data = lines1,
aes(x = x1, y = y1, xend = x2, yend = y2),
alpha = .2, lty = 2) +
geom_segment(data = lines2,
aes(x = x1, y = y1, xend = x2, yend = y2),
alpha = .2, lty = 2) +
geom_segment(data = lines3,
aes(x = x1, y = y1, xend = x2, yend = y2),
alpha = .2, lty = 2) +
geom_line(aes(x = CumTestedPct, y = CumEventPct, col = liftModelVar)) |
|
Take a look at the changes I checked in and feel free to make suggestions. |
|
@topepo, I will have a look in the next two days |
Is would be possible to have lift charts in ggplot2? Current the old, legacy, lattice package is used.