A thick average partial-dependence line over thin per-observation ICE
curves. Map group to the observation id to draw the ICE spaghetti.
geom_partial_dependence(
mapping = NULL,
data = NULL,
color = NULL,
ice = TRUE,
ice_alpha = 0.25,
linewidth = NULL
)A Layer to add with +.
d <- data.frame(
x = rep(1:10, 5), id = rep(1:5, each = 10),
pred = as.vector(sapply(1:5, function(i) (1:10) * 0.1 * i + rnorm(10, 0, .1)))
)
ggnext(d, aes(x, pred, group = id)) + geom_partial_dependence()
#> <ggnext plot>
#> data: 50 x 3
#> aes: x = x, y = pred, group = id
#> layers: 1
#> coord: cartesian
#> mode: static