11-04-2013
02:04 PM
- last edited on
10-16-2024
06:27 PM
by
Content Cleaner
Hi guys,
When I was looking for an example on how to plot a boxplot in LabVIEW I found these two examples:
https://forums.ni.com/t5/Example-Code/Creating-Boxplots-Using-LabVIEW/ta-p/3534434
https://forums.ni.com/t5/Example-Code/Boxplots-and-Stem-and-Leaf-Displays/ta-p/4100673
On first glance the example boxplot.vi in the library boxplot.llb seemed OK, but apparently there's something wrong with the upper whisker.
It extends all the way to around 120, but it should be 100 (this is the largest number in the population).
See the attached screenshot. The other elements (median, quartiles, lower whisker) are OK.
The other screenshot (from Gnumeric) shows the correct boxplot for the population: 18,27,34,52,54,59,61,68,78,82,85,87,91,93,100
You can also verify this online: http://www.alcula.com/calculators/statistics/box-plot/ or use a spreadsheet/statistical program like Excel, Gnumeric or SPSS.
Before I dive into the code, can anybody please verify this bug exists or am I doing something wrong? Thanks in advance.
Paul
Solved! Go to Solution.
11-04-2013 02:58 PM
Don't look now, but it seems like your bottom whisker is wrong, too. Show us what you've done (your VI) and chances are good that someone can see where the problem occurs.
Cameron
11-05-2013 01:53 AM
Hi Cameron,
Thanks for your reply. To answer your question: I haven't modified anything yet, this is the result you get when you run boxplot.vi from the library boxplot.llb which you can download from https://decibel.ni.com/content/docs/DOC-4929
Paul
11-05-2013
06:31 AM
- last edited on
10-16-2024
06:29 PM
by
Content Cleaner
Hello Paul,
It seems like there are 2 (or even more) different boxplot.llb's downloadable from the web.
Are you using the one that was originally provided by this white paper: https://forums.ni.com/t5/Example-Code/Boxplots-and-Stem-and-Leaf-Displays/ta-p/4100673#toc2
Or are you using the modified version used/made by "Hillman":
https://forums.ni.com/t5/Example-Code/Creating-Boxplots-Using-LabVIEW/ta-p/3534434
I'm guessing the latter because you refer to that Community page, but on that Community page they refer back to the white paper
Please let me know, so that I'm sure which one you're talking about.
11-05-2013 07:01 AM - edited 11-05-2013 07:24 AM
Hello Thierry,
I'm referring to the one modified by 'Hillman', however it doesn't matter which one you download: both the 'Hillman' version as the original version show the same behaviour.
The problem seems to be the 'compute whiskers.vi' library component. It's the same in both libraries.
Paul
11-05-2013 08:18 AM
In the explanation of boxplots in the original whitepaper (which is the one Hillman uses, just putting bars at the end of the whiskers for clarity), there is the statement in the first paragraph under the first boxplot figure, "The whiskers are 1.5 times the inner quartile spread in length, which you measure from the median." Like you say, this is not how "normal" boxplots work (at least not in my experience). If you go into the subVIs, however, you could easily change your whiskers to give the max and min of your arrays as whisker ends, rather than the computed values from "Compute Whiskers.VI".
Cameron
11-06-2013 02:27 AM
Hi Cameron,
You're right, the boxplot isn't wrong, but using 1.5 IQ and 3 IQ for calculating the whiskers is not very common. The common way is using the min. and max. non-outlier data for calculating the whisker lengths. To be sure I asked a statistician and according to her both methods have their ad- and disadvantages.
For future reference and to help others, here's the alternative method of calculating and drawing the whiskers (compute boxplot data.vi):
Thank you for your help.
Paul