108 views (last 30 days)
I have a very large set of data with many groups and subgroups. The boxplot command works well for visualization of the data. I was wondering if there was an easy way to extract the data displayed without actually doing a manual calculation of each parameter. For example, I wish boxplot provided a set of function output variables that report the values used to plot each box (mean, interquartile range, outliers, etc.)
Does anyone know of an easy way to extract this information automatically?
I know that I can manually write a script to calculate each of the values...just wondering if there is a shortcut.
Maria Battle on 9 Dec 2020
Edited: Maria Battle on 9 Dec 2020
Similar to Oleg's answer, you could use the functions iqr and mean to address your first concerns. Note: interquartile uses median, not mean. For interquartile outlier output, use the 'quartiles' method for isoutlier. To get the same results between boxplot and isoutlier, make sure the whisker value in boxplot is the same value as the threshold factor in isoutlier.
t = datetime('2015-12-18 12:00:00') + days(1:120)';
g = grades(:,1);
boxplot(g, 'Whisker', .5);
io = isoutlier(g,'quartiles','ThresholdFactor', .5);
outg = g(io);
outt = t(io);
t = table(outt, outg);