x-axis of multcompare() does not plot group means

조회 수: 13 (최근 30일)
Sascha Frölich
Sascha Frölich 2022년 5월 24일
편집: Scott MacKenzie 2022년 5월 28일
Hi,
I am performing an ANOVA on four different groups (data appended). I am using the following code:
[p, tbl, stats] = kruskalwallis(data(:, 1:4));
[c, m, h, gnames] = multcompare(stats);
The group means are 1.1793, 1.5778, 3.8336, 0.9215. However, the figure output by multcompare(stats) has an x-axis range from 100 to 350 (see image). I am confused since as far as I know, the group means should be on the x-axis. Did I do anything wrong?

채택된 답변

Scott MacKenzie
Scott MacKenzie 2022년 5월 28일
편집: Scott MacKenzie 2022년 5월 28일
You didn't do anything wrong. The Kruskal Wallis procedure, being non-parametric, works with the rank-transformed data, not the raw data. The group means in the multcompare chart are the means of the ranked data in each group.
Alternatively, if the raw data are parametric, you can avoid transforming the data to ranks by using anova1 instead of kruskalwallis:
data = readmatrix('testdata.txt'); % your data
[p, tbl, stats] = anova1(data);
[c, m, h, gnames] = multcompare(stats);
Output:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Analysis of Variance and Covariance에 대해 자세히 알아보기

태그

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by