Hi:
ggplot2 does not support prediction intervals natively so you have to
roll your own and add them to the plot manually.
# Fit a linear model
m <- lm(wt ~ qsec, data = mtcars)
# cbind the predictions to mtcars
mpi <- cbind(mtcars, predict(m, interval = "prediction"))
library(ggplot2)
ggplot(mpi, aes(x = qsec)) +
geom_ribbon(aes(ymin = lwr, ymax = upr),
fill = "blue", alpha = 0.2) +
geom_point(aes(y = wt)) +
geom_line(aes(y = fit), colour = "blue", size = 1)
Dennis
> --
> --
> You received this message because you are subscribed to the ggplot2 mailing
> list.
> Please provide a reproducible example:
>
https://github.com/hadley/devtools/wiki/Reproducibility
>
> To post: email
ggp...@googlegroups.com
> To unsubscribe: email
ggplot2+u...@googlegroups.com
> More options:
http://groups.google.com/group/ggplot2
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ggplot2" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
ggplot2+u...@googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.