Multcompare function does not compare all variable groups from anova2

조회 수: 6 (최근 30일)
Hi,
I am using the function anova2 to complete a two-way ANOVA. Here is the data:
d =
1.0e+03 *
0.0053 0.9991
0.0042 1.6223
0.0044 1.2638
0.0016 0.0031
0.0024 0.0036
0.0018 0.0036
Here is the code I ran:
[p,h,s]=anova2(d,3)
both columns and rows were significant with significant interaction:
p =
1.0e-04 *
0.9668 0.9543 0.9827
I ran multcompare on this analysis
[c, m, h, nms] = multcompare(s,'alpha',0.05,'ctype','bonferroni')
and this was my result:
c =
1.0000 2.0000 -854.1768 -645.9667 -437.7565
I realize that you can specify either column or row for the multcompare function, but shouldn't the multcompare function compare all quadrants:
i.e.
d =
1 2
3 4
Shouldn't the multcompare function compare 1 & 2, 1 & 3, 1 & 4, 2 & 3, 2 & 4 and 3 & 4, because both columns and rows were significantly different. Maybe I am misunderstanding how the multcompare function works.
Any help would be greatly appreciated. Thanks.
Beth

채택된 답변

Tom Lane
Tom Lane 2013년 5월 10일
You are right, it looks like multcompare with anova2 can only compare one dimension at a time. But multcompare with anovan can compare both. Try this:
row = [1 1 1 2 2 2 1 1 1 2 2 2]';
col = [1 1 1 1 1 1 2 2 2 2 2 2]';
[p,~,s] = anovan(d(:),{row col},'interaction')
multcompare(s,'dim',1:2)

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by