[R] Boxplot has only one whisker

Ivan Calandra ivan.calandra at uni-hamburg.de
Wed Oct 13 11:06:12 CEST 2010


  Well, you don't use the same data for both.
Type 2 and 7 give different values for the 25 and 75%, which correspond 
more or less to the box hinges.
If you take a look at how the whiskers are defined (look at ?boxplot.stats):
"|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."
In your example, the box for "method1" is short; the 100% point is then 
further that 1.5*length of the box (IQR), which is then considered as 
outlier. Note that the default for coef is 1.5 (hence the 1.5*IQR). On 
the other hand, for method 2, the box is longer; the largest point is 
therefore within 1.5*IQR and plotted with the upper whisker.
Understand what I mean?
See that post too, they might have better explanations:
http://finzi.psych.upenn.edu/Rhelp10/2010-May/238597.html

But don't forget my second comment: you boxplot() summary data. From my 
understanding, you should not do that. Boxplot() returns the statistics 
itself (look at the value section from ?boxplot). Try:
bx <- boxplot(d,ylab = "Beispiel 1",range = 1.5)
bx$stats
[,1] [,2]
[1,] 2.7000 2.700
[2,] 3.0000 2.900
[3,] 3.3000 3.300
[4,] 4.8625 6.225
[5,] 4.8625 8.950

You can see that boxplot() recomputed the summary stats from the summary 
stats you gave as input, and plotted them!
You should provide raw data to boxplot(), not summary stats.
If you want to input summary stats, there was a post some time ago on that:
http://finzi.psych.upenn.edu/Rhelp10/2010-September/251674.html

HTH,
Ivan

Le 10/13/2010 10:33, tom a écrit :
>
> Ivan Calandra wrote:
>>    Try with more data points?!
>> You have only five points, the last one being considered as outlier.
>> Note that boxplot() requires a numeric vector for specifying data from
>> which the boxplots are to be produced!
>>
> But why is only one of the boxplots missing his whisker? I use the same data
> for both boxplots.
> thx,
> tom
>
>
>
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list