[R] Confidence Inteval for regression curve.

hadley wickham h.wickham at gmail.com
Sun Jan 6 02:53:25 CET 2008


On Jan 5, 2008 7:45 PM, Milton Cezar Ribeiro <milton_ruser at yahoo.com.br> 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:

install.packages("ggplot2")
library(ggplot2)

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 http://had.co.nz/ggplot2/stat_smooth.html

Hadley

-- 
http://had.co.nz/




More information about the R-help mailing list