# [R] error bars

Markus Schmotz markus.schmotz at uni-konstanz.de
Tue Mar 30 12:17:39 CEST 2010

```you can write a function for yourself using arrows:

#x,y: dataset as vectors
#xe,ye: errors per entry as vectors, if the errors are symmetric
arrbar<-function(x,y,xe,ye){
l<-length(x)
for (i in 1:l) {
arrows(x[i],y[i],x[i]-xe[i]/2,y[i],angle=90,length=0.05)
arrows(x[i],y[i],x[i]+xe[i]/2,y[i],angle=90,length=0.05)
arrows(x[i],y[i],x[i],y[i]-ye[i]/2,angle=90,length=0.05)
arrows(x[i],y[i],x[i],y[i]+ye[i]/2,angle=90,length=0.05)
}
}

Iasonas Lamprianou schrieb:
> Dear friends,
> I have a statistical question. Sometimes, if I compare boys to girls on a specific variable, the error bars (confidence interval of means) seem to overlap slightly. Still, when I run a t-test, I find statistically significant differences. The rule is clear: if the confidence intervals do not overlap, then there is statistically significant difference. But if they overlap slightly, we have to use a t-test to know for sure if the the two means differ significantly. The point is: is there a rule of thumb to say, for example, "if the overlap is less than 20% of the length of the standard error, then a t-test would give significant results?"
>
> thank you for your time
>
> P.S.1 is there an easy way to plot error bars in R?
>
> jason
>
> Dr. Iasonas Lamprianou
>
>
> Assistant Professor (Educational Research and Evaluation)
> Department of Education Sciences
> European University-Cyprus
> P.O. Box 22006
> 1516 Nicosia
> Cyprus
> Tel.: +357-22-713178
> Fax: +357-22-590539
>
>
> Honorary Research Fellow
> Department of Education
> The University of Manchester
> Oxford Road, Manchester M13 9PL, UK
> Tel. 0044  161 275 3485
> iasonas.lamprianou at manchester.ac.uk
>
>
>
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> and provide commented, minimal, self-contained, reproducible code.

--

_______________________________
Dipl.-Phys. Markus Schmotz
Universität Konstanz
Fachbereich Physik, Lehrstuhl Leiderer
Postfach M 676
D-78457 Konstanz
Tel.: +49 7531 88 3803, Fax: 3127
Mail: markus.schmotz at uni-konstanz.de

```