Skip to content
Back to formatted view

Raw Message

Message-ID: <3710.030511@eimb.ru>
Date: 2003-05-11T13:03:06Z
From: Vladimir Eremeev
Subject: what does boxplot draw?
In-Reply-To: <200305111010.h4BA2Yru016730@hypatia.math.ethz.ch>

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