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