How does multcompare function work?

12 Ansichten (letzte 30 Tage)
Yasmin Tamimi
Yasmin Tamimi am 27 Jul. 2012
Kommentiert: Lingyun GUO am 10 Jul. 2020
Hey everyone,
I have done kruskal wallis test and then performed multcompare function (tukey test). Matrix X that I used in K-W test 2 columns each one corresponds to a disease, and for each disease that data is belongs to 70 patients so the matrix is 70x2. My question is that in the multcompare the comparison is done pairwise which means the first result I get corresponds to the comparison of the the first row? And regarding the example in matlab
For example, suppose one row contains the following entries.
2.0000 5.0000 1.9442 8.2206 14.4971
These numbers indicate that the mean of group 2 minus the mean of group 5 is estimated to be 8.2206, and a 95% confidence interval for the true mean is [1.9442, 14.4971].
here what is meant by group 2 and group 5; while we only have 2 columns in the matrix?!

Akzeptierte Antwort

Tom Lane
Tom Lane am 27 Jul. 2012
Can you be more specific about what code you ran? When I try this, I only get groups 1 and 2, comparing the two columns:
>> [~,~,s] = kruskalwallis(rand(30,2));
>> multcompare(s)
Note: Intervals can be used for testing but are not simultaneous confidence intervals.
ans =
1.0000 2.0000 -10.1712 -1.3333 7.5045
Also, you wrote K-S test in one place; I assume this is a typo and you are not doing a Kolmogorov-Smirnov test.
  4 Kommentare
Yasmin Tamimi
Yasmin Tamimi am 14 Aug. 2012
Its because I thought that multcompare compares only between two columns and not more!! Thanx a lot Tom really appreciated!!
Lingyun GUO
Lingyun GUO am 10 Jul. 2020
Dear Tom & Yasmin::
I want to ask
I have 3 sets of data. It has been organized into two columns The first column is basedata; The second column is the grouping basis.
G1(:,1)=rand(30,1);
G1(:,2)=1;
G2(:,1)=rand(32,1);
G2(:,2)=2;
G3(:,1)= rand(30,1);
G3(:,2)=3;
X=[G1;G2;G3]; % size is (92*2).
[P,anovatab,stats] = kruskalwallis(X(:,1),X(:,2));
c2=multcompare(stats);
The answer is:
1 2 -18.21 -2.31 13.60 0.94
1 3 -11.96 4.20 20.36 0.82
2 3 -9.40 6.51 22.41 0.60
In order to verify that the data is accurate, I continued to carry out two separate KW test data.
A= [G1;G2];
[P,anovatab,stats] = kruskalwallis(A(:,1),A(:,2));
c2=multcompare(stats);
The answer is:
1 2 -10.34 -1.35 7.63 0.77
Got the p value of their difference. Why, Which p value can truly reflect the difference between G1 and G2?
I'm looking forward to your reply very much.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by