[R] lm: Displaying 95% confidence and prediction intervals on scatterplots

hadley wickham h.wickham at gmail.com
Sat Jul 15 11:03:18 CEST 2006


> May I know  how does one superimpose the 95% confidence and prediction
> intervals on the linear regression line of a scatterplot?

You could use ggplot:

install.packages("ggplot")
library(ggplot)
qplot(wt, mpg, data=mtcars, type=c("point","smooth"), method=lm)

(which gives the 95% confidence interval)

Hadley



More information about the R-help mailing list