Re: [R] Confidence Inteval for regression curve.

From: hadley wickham <>
Date: Sat, 5 Jan 2008 19:53:25 -0600

On Jan 5, 2008 7:45 PM, Milton Cezar Ribeiro <> wrote:
> Dear all,
> I have a dataset which I need to estimate the regression model and plot the estimated curve two other curves with low and high confidence interval (CI=95%). How can I do that?

The easiest way is to use the ggplot2 package:


x <- 1:100
y <- x^0.2+rnorm(100,0.1,0.1)

qplot(x, y, geom=c("smooth", "point"))
qplot(x, y, geom=c("smooth", "point"), method=lm)
qplot(x, y) + geom_smooth(fill="grey70", method=lm)

You can see more examples at



______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Sun 06 Jan 2008 - 01:56:14 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 06 Jan 2008 - 04:30:05 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive