Is the calculation of the median including outliers?

조회 수: 17 (최근 30일)
hmhuang
hmhuang 2022년 2월 13일
답변: Voss 2022년 2월 13일
In MATLAB's box plot, is the calculation of the median including outliers? or just including only data between upper whiskers and lower whiskers?
  댓글 수: 1
hmhuang
hmhuang 2022년 2월 13일
If outliers are not considered, how to include outliers inside whiskers so that they are involved in the calculation of the median?

댓글을 달려면 로그인하십시오.

채택된 답변

Voss
Voss 2022년 2월 13일
Let's do a test to try to figure it out:
rng(2);
data = randn(1,10);
figure();
plot(data)
med = median(data);
med_no_outlier = median(data(data > min(data)));
figure();
yline(med,'--g');
hold on
yline(med_no_outlier,'--m');
boxplot(data);
The median line from boxplot() matches the median calculated using all the data, so it looks like boxplot() uses all the data to compute the median.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by