First off, it is not precisely defined what the whiskers represent. According to wikipedia, one version is that the whiskers represent the minimum and maximum of your values, which is apparently not your case. Alternatively, you could be looking for the Tukey standard, which is something like "the lowerst/highest value within 1.5 IQR". In that case, the math for your first sample is p25=2 , p75=62 , iqr=60 , lowerWhisker=0 and upperWhisker=136 :
| stats count | fields - count | eval foo="0,0,0,0,1,1,2,2,2,5,7,9,9,11,12,17,18,46,62,74,103,136,188,193" | makemv delim="," foo | mvexpand foo
| eventstats p25(foo) as p25 p75(foo) as p75 | eval iqr=p75-p25 | eval lowerWhisker=if(foo>=(p25-iqr*1.5), foo, iqr) | eval upperWhisker=if(foo<=(p75+iqr*1.5), foo, iqr) | eventstats min(lowerWhisker) as lowerWhisker max(upperWhisker) as upperWhisker | eval status=case(foo>=p25 AND foo<=p75, "in box", foo<lowerWhisker OR foo>upperWhisker, "outlier", 1=1, "in whiskers")
This doesn't seem to match either of your results (the one from boxplot and your own math).
Then there's the option that the whiskers represent the standard deviation around the median, which would result in mean=9 , stdev=59.220235 and thus lowerWhisker=-50.220235 (or 0, depending on your preference) and upperWhisker=68.220235 :
| stats count | fields - count | eval foo="0,0,0,0,1,1,2,2,2,5,7,9,9,11,12,17,18,46,62,74,103,136,188,193" | makemv delim="," foo | mvexpand foo
| eventstats median(foo) as median stdev(foo) as stdev | eval lowerWhisker=median-stdev | eval upperWhisker=median+stdev
These are not your values either, so my guess is your case is one of an arbitrary definition of what your whiskers are supposed to be, wikipedia mentions some kind of 9th/91st percentile. There are many funny ways to make your statistics look how you want it to.
I think your problem is not with boxplot, your problem is with how you "do the math" and apply it to the visual representation - there are multiple ways to do it, and you can't point out which one is "correct".
... View more