フィルターのクリア

Boxplot Data

97 ビュー (過去 30 日間)
Seth
Seth 2011 年 6 月 23 日
コメント済み: Maria Battle 2021 年 12 月 8 日
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
Maria Battle 2020 年 12 月 9 日
編集済み: Maria Battle 2020 年 12 月 9 日
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.
load examgrades
t = datetime('2015-12-18 12:00:00') + days(1:120)';
g = grades(:,1);
figure
boxplot(g, 'Whisker', .5);
io = isoutlier(g,'quartiles','ThresholdFactor', .5);
outg = g(io);
outt = t(io);
t = table(outt, outg);
  2 件のコメント
Aymen ABID
Aymen ABID 2021 年 3 月 19 日
isoutlier not exist in r2016
Maria Battle
Maria Battle 2021 年 12 月 8 日
In that case, you might try using Matlab's quantile function and create a condition for your threshold. I believe that's basically what isoutlier() is doing when you use the quartiles and ThresholdFactor options. I haven't tried it though.

サインインしてコメントする。

その他の回答 (2 件)

Oleg Komarov
Oleg Komarov 2011 年 6 月 23 日
It way easier to calculate the stats:
min
max
quantile(x,[.25 .5 .75])
mean
  2 件のコメント
Rania Rayyes
Rania Rayyes 2020 年 1 月 8 日
編集済み: Rania Rayyes 2020 年 1 月 8 日
median and not mean, and the upper bound is not max, max is outlier here
Aymen ABID
Aymen ABID 2021 年 3 月 19 日
編集済み: Aymen ABID 2021 年 3 月 19 日
@Rania Rayyes quabtile .25 .5 .75 gives Q1,Q2 (median),Q3
median with isnan give the median

サインインしてコメントする。


zahra zol
zahra zol 2017 年 4 月 15 日
i am desperately looking for the same thing...
  1 件のコメント
Samuel Geurts
Samuel Geurts 2017 年 9 月 14 日
編集済み: Samuel Geurts 2017 年 9 月 14 日
if you open de handle of the boxplot you can achieve that information, but that is not easier than calculating it.
h = boxplot(x)
handle(h)

サインインしてコメントする。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by