# NOT RUN {
data(efc)
fit <- lm(
tot_sc_e ~ c12hour + e42dep + e17age + I(e17age^2) + I(e17age^3),
data = efc
)
dat <- ggpoly(fit, "e17age")
# this would give the same result
ggpredict(fit, "e17age")
library(ggplot2)
ggplot(dat, aes(x, predicted)) +
stat_smooth(se = FALSE) +
geom_ribbon(aes(ymin = conf.low, ymax = conf.high), alpha = .15) +
labs(x = get_x_title(dat), y = get_y_title(dat))
# }
# NOT RUN {
# or:
plot(dat)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab