[R] plotting multiple CIs

Ista Zahn istazahn at gmail.com
Fri Apr 30 16:35:24 CEST 2010


Hi Giovanni,
I think the ggplot2 package might help you out here. Do you want
something like this?

library(ggplot2)
data(mtcars)

p <- ggplot(mtcars, aes(x=cyl, y=mpg))

p + stat_summary(fun.data = "mean_cl_boot", colour = "red", geom =
"errorbar") +  stat_summary(fun.data = "mean_cl_normal", colour =
"blue", geom = "errorbar")

?

See http://had.co.nz/ggplot2/stat_summary.html for details.

-Ista

On Fri, Apr 30, 2010 at 3:10 PM, Giovanni Azua <bravegag at gmail.com> wrote:
> Hello,
>
> I need to plot multiple confidence intervals for the same model parameter e.g. so for the same value of the parameter in point x_1 I would like to see four different confidence intervals so that I can compare the accuracy e.g. boot basic vs normal vs my own vs classic lm CI etc.
>
> I like very very much the plotCI implemented here:
> http://cran.r-project.org/web/packages/plotrix/index.html
>
> This is their example:
> library(plotrix)
> y <- runif(10)
> err <- runif(10)
> plotCI(x=1:10,y=y,uiw=err,liw=2*err,lwd=2,col="red",scol="blue",main="Add colors to the points and error bars")
>
> but does not seem to support plotting multiple CIs but only one per point, is there a similar library somewhere but having the possibility to plot multiple CIs?
>
> I know there is the function "segment" but I like this one above more :)
>
> Thanks in advance,
> Best regards,
> Giovanni
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org



More information about the R-help mailing list