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

From: hadley wickham <h.wickham_at_gmail.com>
Date: Sat 15 Jul 2006 - 19:03:18 EST

> 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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Jul 15 19:09:16 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Sat 15 Jul 2006 - 22:14:36 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.