Skip to content

Confidence intervals plot

4 messages · Ramon Martínez Coscollà, Duncan Murdoch, Marc Schwartz +1 more

#
On Sat, 14 Jun 2003 20:44:09 +0200, you wrote:

            
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
#
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
corresponding to a x value. Their extrem points would be the confidence interval limits.