[R] Whiskers on the default boxplot {graphics}

RJ Cunningham robut at iinet.net.au
Wed May 12 04:57:48 CEST 2010


   I think not. Isn't the "secret" here?
   Arguments:
   x: a numeric vector for which the boxplot will be constructed
   ('NA's and 'NaN's are allowed and omitted).
   coef: this determines how far the plot 'whiskers' extend out
   from the box. If 'coef' is positive, the whiskers extend
   to the most extreme data point which is no more than
   'coef' times the length of the box away from the box. A
   value of zero causes the whiskers to extend to the data
   extremes (and no outliers be returned).
   do.conf,do.out: logicals; if 'FALSE', the 'conf' or 'out'
   component respectively will be empty in the result.
   Details:
   The two 'hinges' are versions of the first and third quartile,...
   On Wed May 12 10:35 , Jason Rupert sent:

     Humm....Maybe  I  need  to  look some place else than boxplot.stats
     {grDevices} for a definition of how the upper/lower whiskers are produced.
     By any chance are they "the lowest datum still within 1.5 IQR of the lower
     quartile,  and  the highest datum still within 1.5 IQR of the upper
     quartile"?
     None of the links from boxplot.stats {grDevices} seemed to reveal the
     secret definition of the R whiskers.
     Thanks again.
     ----- Original Message ----
     From: Jason Rupert <[1]jasonkrupert at yahoo.com>
     To: David Winsemius <[2]dwinsemius at comcast.net>
     Cc: R Project Help <[3]R-help at r-project.org>
     Sent: Tue, May 11, 2010 9:26:25 PM
     Subject: Re: [R] Whiskers on the default boxplot {graphics}
     Wowzers...
     >From ?boxplot.stats:
     Details
     The two âhingesâ are versions of the first and third quartile, i.e., close
     to quantile(x, c(1,3)/4). The hinges equal the quartiles for odd n (where
     n <- length(x)) and differ for even n. Whereas the quartiles only equal
     observations for n %% 4 == 1 (n = 1 mod 4), the hinges do so additionally
     for n %% 4 == 2 (n = 2 mod 4), and are in the middle of two observations
     otherwise.
     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.
     Is a notch equal to the upper/lower whisker? Is this just a difference of
     terminology or something?
     Thanks again for all the insights.
     ----- Original Message ----
     From: David Winsemius <[4]dwinsemius at comcast.net>
     To: Jason Rupert <[5]jasonkrupert at yahoo.com>
     Cc: R Project Help <[6]R-help at r-project.org>
     Sent: Tue, May 11, 2010 9:00:15 PM
     Subject: Re: [R] Whiskers on the default boxplot {graphics}
     On May 11, 2010, at 9:45 PM, Jason Rupert wrote:
     > How are the lower/upper whiskers defined in the default version of
     boxplot {graphics}?
     >
     > I tried help(boxplot) and searching [7]www.rseek.org, but I was unable
     to determine an absolute answer.
     You need to follow the links from the help pages and tin this case it
     appears that you did not follow the one to
     ?boxplot.stats
     >
     >  I  checked  out the definition of boxplot according to Wikipedia
     ([8]http://en.wikipedia.org/wiki/Box_plot\), but it also had several
     approaches
     > listed for how the whiskers could be determined, so I'm just curious how
     the default
     > boxplot {graphics} does it.
     >
     > Thanks for any feedback
     Follow links with the R help system.
     > and insights.
     David Winsemius, MD
     West Hartford, CT
     ______________________________________________
     [9]R-help at r-project.org mailing list
     [10]https://stat.ethz.ch/mailman/listinfo/r-help
     PLEASE do read the posting guide
     [11]http://www.R-project.org/posting-guide.html
     and provide commented, minimal, self-contained, reproducible code.
     ______________________________________________
     [12]R-help at r-project.org mailing list
     [13]https://stat.ethz.ch/mailman/listinfo/r-help
     PLEASE do read the posting guide
     [14]http://www.R-project.org/posting-guide.html
     and provide commented, minimal, self-contained, reproducible code.

References

   1. javascript:top.opencompose%28%27jasonkrupert at yahoo.com%27,%27%27,%27%27,%27%27%29
   2. javascript:top.opencompose%28%27dwinsemius at comcast.net%27,%27%27,%27%27,%27%27%29
   3. javascript:top.opencompose%28%27R-help at r-project.org%27,%27%27,%27%27,%27%27%29
   4. javascript:top.opencompose%28%27dwinsemius at comcast.net%27,%27%27,%27%27,%27%27%29
   5. javascript:top.opencompose%28%27jasonkrupert at yahoo.com%27,%27%27,%27%27,%27%27%29
   6. javascript:top.opencompose%28%27R-help at r-project.org%27,%27%27,%27%27,%27%27%29
   7. file://localhost/tmp/parse.pl?redirect=http://www.rseek.org
   8. file://localhost/tmp/parse.pl?redirect=http://en.wikipedia.org/wiki/Box_plot%29%2C
   9. javascript:top.opencompose%28%27R-help at r-project.org%27,%27%27,%27%27,%27%27%29
  10. file://localhost/tmp/parse.pl?redirect=https://stat.ethz.ch/mailman/listinfo/r-help
  11. file://localhost/tmp/parse.pl?redirect=http://www.R-project.org/posting-guide.html
  12. javascript:top.opencompose%28%27R-help at r-project.org%27,%27%27,%27%27,%27%27%29
  13. file://localhost/tmp/parse.pl?redirect=https://stat.ethz.ch/mailman/listinfo/r-help
  14. file://localhost/tmp/parse.pl?redirect=http://www.R-project.org/posting-guide.html


More information about the R-help mailing list