[R] what does boxplot draw?

Wladimir Eremeev wl at eimb.ru
Sun May 11 15:03:06 CEST 2003


Dear r-help,

   Unfortunately I cannot find in the documentation what determines
   ranges of a 'box' in the box-and-whisker plot.
   
   It is said in "Simple R" (http://www.math.csi.cuny.edu/Statistics/R/simpleR)
   that they are 1st and 3rd Qus usually.

   I tried to add to boxplot lines with (quantile(x,probs=0.25)), but
   lines do not coincide with edges of boxes.

Here's the example. I've got 3 vectors of values, x1,x2,x3

The command

boxplot(list(x1,x2,x3))

draws 3 box-and-whisker diagrams.

Commands

lines(c(quantile(x1,probs=c(0.25)),quantile(x2,probs=c(0.25)),quantile(x3,probs=c(0.25))))
lines(c(quantile(x1,probs=c(0.75)),quantile(x2,probs=c(0.75)),quantile(x3,probs=c(0.75))))

draw lines with y values of quantiles.
Lines ends are close to the box edges but not exactly on them.
While command

lines(c(median(x1),median(x2),median(x3)))

puts lines with ends exactly on the middle line of the box-and-whisker
plots.

-- 
Best regards
Wladimir Eremeev                                     mailto:wl at eimb.ru




More information about the R-help mailing list