[R] Strange horns on notched box plots

Ben Bolker bolker at ufl.edu
Thu Oct 9 02:45:51 CEST 2008


Frostygoat <FrostyGoat <at> gmail.com> writes:

> 
> Hi I'm getting a weird result when I try to switch from a normal box
> plot to a notched one.  The ends of the box fold down toward the
> median giving a horned appearance.  Is just the sample itself?  It is
> small, but the un-notched plot looks okay.  Anyway to fix this?
> 
> e7=as.vector(c(234,37,98,116,47))
> boxplot(e7, plot=TRUE, notch=TRUE)
> 
> Thanks very much.
> 

   Use a larger sample :-)

  You may have noticed that you got a warning

some notches went outside hinges ('box'): maybe set notch=FALSE

   This is because the size of the notch is bigger than
the interquartile range: from ?boxplot

The notches (if requested) extend to +/-1.58 IQR/sqrt(n). This seems to be based
on the same calculations as the formula with 1.57 in Chambers et al. (1983, p.
62), given in McGill et al. (1978, p. 16). They are based on asymptotic
normality of the median and roughly equal sample sizes for the two medians being
compared, and are said to be rather insensitive to the underlying distributions
of the samples. The idea appears to be to give roughly a 95% confidence interval
for the difference in two medians. 

  So the notches are actually larger than the 'hinges' ...

  Ben Bolker

   There's not much you can do about this.



More information about the R-help mailing list