Hey hey, I`m analyzing a data set containing the element contentrations of various samples... I wanted to construct notched boxplots and got quite ugly results for some of the boxplots. The notches are often larger then the hinges which resulted in weird looking edges (even though I`m using a log-boxplot). To avoid this problem I thought about using "normal" log-boxplots and adding some kind of parantheses for showing the confidence interval. I found an option to do this with the help of the package "psych". It works beautifully for sth like that: x <- replicate(20,rnorm(50)) boxplot(x,notch=TRUE,main="Notched boxplot with error bars") error.bars(x,add=TRUE) abline(h=0) I tried to apply this to my own dataset: ## Ag boxplotDAS(log10(Ag)~Aquifer,ylab="",xlab="Ag (mg/l)", main="", data=samples, notch=TRUE, horizontal=TRUE, xaxt="n", col="gray85") error.bars(samples,add=TRUE) axis(1,at=log10(a<-sort(c((10^(-50:50))%*%t(c(1,5))))),labels=a, tick=T) abline(v=log10(a),lty=3,col='gray') I end up with lots of error messages - all of them saying: Warning in arrows(s[s], x.stats$mean[s] - ci[s] * x.stats$se[s], s[s], x.stats$mean[s] + : zero-length arrow is of indeterminate angle and so skipped What does that mean and how can I get rid of it? Any ideas? Thanks a lot, fussel -- View this message in context: http://n4.nabble.com/Error-message-when-using-error-bars-x-add-TRUE-tp1560278p1560278.html Sent from the R help mailing list archive at Nabble.com.
On 2010-02-18 8:22, fussel wrote:> > Hey hey, > I`m analyzing a data set containing the element contentrations of various > samples... > I wanted to construct notched boxplots and got quite ugly results for some > of the boxplots. The notches are often larger then the hinges which resulted > in weird looking edges (even though I`m using a log-boxplot). To avoid this > problem I thought about using "normal" log-boxplots and adding some kind of > parantheses for showing the confidence interval. > I found an option to do this with the help of the package "psych". > > It works beautifully for sth like that: > x<- replicate(20,rnorm(50)) > boxplot(x,notch=TRUE,main="Notched boxplot with error bars") > error.bars(x,add=TRUE) > abline(h=0)Beautifully? To me, that's one of the ugliest plots I've seen in a while. But, as they say, it's in the eye of the beholder. Anyway, what is the purpose of the notches? It's not clear to me that you understand them. There's a good reason why the notches sometimes stick out beyond the box. This is usually the result of a small sample. If you have variable sample sizes you might find variable-width boxplots somewhat informative. Personally, I don't have much for use notched boxplots.> I tried to apply this to my own dataset: > > ## Ag > boxplotDAS(log10(Ag)~Aquifer,ylab="",xlab="Ag (mg/l)", main="", > data=samples, notch=TRUE, horizontal=TRUE, xaxt="n", col="gray85") > error.bars(samples,add=TRUE) > axis(1,at=log10(a<-sort(c((10^(-50:50))%*%t(c(1,5))))),labels=a, tick=T) > abline(v=log10(a),lty=3,col='gray') > > > I end up with lots of error messages - all of them saying: > > Warning in arrows(s[s], x.stats$mean[s] - ci[s] * x.stats$se[s], s[s], > x.stats$mean[s] + : > zero-length arrow is of indeterminate angle and so skipped > > What does that mean and how can I get rid of it? Any ideas?These warning (not 'error') messages come from error.bars(). Why not try to plot the error bars without any boxplots to see where the problems might lie. As a check, I would also do the confidence interval calculations 'by hand'. Or you could provide a *reproducible* example, preferably minimal (i.e. skip the xlab= , etc stuff) and someone might try the code and tell you where the problems lie. -Peter Ehlers> > Thanks a lot, > fussel >
Hey hey, thanks for your answer. Yes, you are right - "beautiful" i something else. I found that thing in the R-help pages. But it would have been a starting point... My dataset consists of almost 1000 individual samples - each of them analysed for the different elements. I think that the sample is big enough to do some statistical analyses with. The problem is, that the concentration of many elements lies below the detection limit and all "<" values were replaced with one half of their value. This causes a very ugly distribution. I know that the data don`t become any better by showing the confidence interval in a different way. I just thought, that parantheses would be more reader-friendly. But I talked to some colleagues in the office, who do not have problems with the notched version. So I finally decided, to keep my boxplots with the weird looking edges =) Thanks a lot for your help, fussel -- View this message in context: http://n4.nabble.com/Error-message-when-using-error-bars-x-add-TRUE-tp1560278p1567510.html Sent from the R help mailing list archive at Nabble.com.