Hi all!! I am trying to plot several confidence intervals in a unique plot. That is, for each x, I have a confidence interval for a parameter related to x and I would like to plot them in the same plot, in order to compare them. The plot would look like some parallel vertical lines, each one corresponding to a x value. Their extrem points would be the confidence interval limits. I do not know if I am clear enough. Anyway, thank you in advance. Ramon. [[alternate HTML version deleted]]
On Sat, 14 Jun 2003 20:44:09 +0200, you wrote:>Hi all!! > >I am trying to plot several confidence intervals in a unique plot. That is, for each x, I have a confidence interval for a parameter related to x and I would like to plot them in the same plot, in order to compare them. The plot would look like some parallel vertical lines, each one corresponding to a x value. Their extrem points would be the confidence interval limits.>I do not know if I am clear enough. Anyway, thank you in advance.Suppose the upper limits are in U, the lower limits in L, and the x values in X. Then # set up the axes etc. plot(X, U, ylim=range(c(L,U)), type='n') segments(X, L, X, U) will do what you describe. You should also look at arrows(), in case you want points or crossbars on the ends of the segments. Duncan Murdoch
>-----Original Message----- >From: r-help-bounces at stat.math.ethz.ch >[mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of Ramon >Mart?nez Coscoll? >Sent: Saturday, June 14, 2003 1:44 PM >To: r-help at stat.math.ethz.ch >Subject: [R] Confidence intervals plot > > >Hi all!! > >I am trying to plot several confidence intervals in a unique >plot. That is, for each x, I have a confidence interval for a >parameter related to x and I would like to plot them in the >same plot, in order to compare them. The plot would look like >some parallel vertical lines, each one corresponding to a x >value. Their extrem points would be the confidence interval limits. > >I do not know if I am clear enough. Anyway, thank you in advance. > >Ramon.You have several options depending upon whether you simply want vertical CI lines above and below xy data points or if you might want a barplot with CI's. You could draw the xy data points using plot() and then draw the CI's yourself using either segments() or arrows() in the base package or see plotCI(), plotmeans() and barplot2() in the 'gregmisc' package on CRAN. plotmeans() is a "wrapper" function that can call plotCI(). HTH, Marc Schwartz
On 14 Jun 2003 at 20:44, Ramon Mart?nez Coscoll? wrote: Hola! First set up a plot with plot( c(x.lower, x.upper) , c(y.lower, y.upper), type="n" ) and then add each line using segments Kjetil Halvorsen> Hi all!! > > I am trying to plot several confidence intervals in a unique plot. That is, for each x, I have a confidence interval for a parameter related to x and I would like to plot them in the same plot, in order to compare them. The plot would look like some parallel vertical lines, each onecorresponding to a x value. Their extrem points would be the confidence interval limits.> > I do not know if I am clear enough. Anyway, thank you in advance. > > Ramon. > [[alternate HTML version deleted]] > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help