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
?boxplot says stats: a matrix, each column contains the extreme of the lower whisker, the lower hinge, the median, the upper hinge and the extreme of the upper whisker for one group/plot. and that's accurate: please prefer the primary documentation to notes you pick up somewhere on the Web. For the definition of `hinge' see ?boxplot.stats and the references therein. (The box goes from the lower hinge to the upper hinge.) On Sun, 11 May 2003, Wladimir Eremeev wrote:> Unfortunately I cannot find in the documentation what determines > ranges of a 'box' in the box-and-whisker plot.It's right there on the help pages for boxplot, bxp and boxplot.stats, with references to the primary published literature.> 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.[...] -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
Wladimir Eremeev <wl at eimb.ru> writes:> 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.The full story is in help(boxplots.stats). It's all a bit quirky, but faithful to the original reference by Tukey. It may be illustrative to do something like lapply(4:10,function(i)cbind( bxp=boxplot.stats(1:i)$stats, qu=quantile(1:i))) -- O__ ---- Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907