[R] error bar position setting

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Tue Jan 22 13:44:27 CET 2008


> I am using 'arrows' funtion to plot the variance as error bar, BUT error
> bar goes only one side of the data point, I need to plot the error bar 
on
> both side of the data point (plot is attached), I am using following
> commands to plot,
> 
> plot(file3$lat,file3$STotwoKm,pch=21,cex=2.5,ylim=c(-0.2,2.5),
> xlim=c(-50,50),xlab=NA,ylab=NA,
> col=1, xaxs="i",yaxs="i")
> 
> arrows(file3$lat, file3$var1, file3$lat,file3$STotwoKm, col=1, code=3,
> angle=90, length=0.1)

Try using the arrows function with y0 as the lower error bound, y1 as the 
upper error bound and code=3, so that arrowheads are drawn at both ends of 
the arrow.

You should double check the y coordinates of the arrows.  If the y values 
are normally distributed, then a 95% confidence interval will give lower 
bounds at yvalues + qnorm(0.025)*sqrt(variance), and an upper bound at 
yvalues + qnorm(0.975)*sqrt(variance).

Regards,
Richie.

Mathematical Sciences Unit
HSL

"Statistics are like a lamp-post to a drunken man - more for leaning on 
than illumination."
David Brent, The Office.

------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list