Multcompare on repeated measure ANOVA object performs double two way comparisons
8 views (last 30 days)
Show older comments
Dear all,
I ran a repeated measure two way ANOVA with a 2 by 4 fully within design. Here is an example of the code I ran:
% generate random data for the example
rndData = randn(24,8);
% Create a table storing the respones
varNames = {'Y1','Y2','Y3','Y4','Y5','Y6','Y7','Y8'};
t = array2table(rndData,'VariableNames',varNames);
% Create a table reflecting the within subject factors 'TestCond', 'Attention', and 'TMS' and their levels
factorNames = {'Cate','Task'};
within = table({'A'; 'A'; 'B'; 'B'; 'C'; 'C'; 'D'; 'D'},{'I';'II';'I';'II';'I';'II';'I';'II'},'VariableNames',factorNames);
% fit the repeated measures model
rm = fitrm(t,'Y1-Y8~1','WithinDesign',within);
% run my repeated measures anova here
[ranovatbl] = ranova(rm, 'WithinModel','Cate*Task');
% make pairwise comparisons for the two-way interactions
%
% see: help RepeatedMeasuresModel/multcompare
multcompare(rm,'Task','By','Cate')
The above multcompare yields the following:
Cate Task_1 Task_2 Difference StdErr pValue Lower Upper
____ ______ ______ __________ _______ ________ _________ ________
'A' 'I' 'II' -0.030251 0.28824 0.91732 -0.62652 0.56602
'A' 'II' 'I' 0.030251 0.28824 0.91732 -0.56602 0.62652
'B' 'I' 'II' -0.09305 0.25671 0.72031 -0.62409 0.43799
'B' 'II' 'I' 0.09305 0.25671 0.72031 -0.43799 0.62409
'C' 'I' 'II' -0.33807 0.34831 0.34184 -1.0586 0.38246
'C' 'II' 'I' 0.33807 0.34831 0.34184 -0.38246 1.0586
'D' 'I' 'II' 0.44612 0.24336 0.079751 -0.057304 0.94955
'D' 'II' 'I' -0.44612 0.24336 0.079751 -0.94955 0.057304
I am a bit confused by the fact that within each 'cate', we perform the following test: I vs II and then II vs I. Both are statisticaly the same, one simply yields the negative of the other. The multcompare corrects for multiple comparison problem paused by such methods, but my worry is that if the multcompare corrects for all the tests displayed here, the correction will actually be exagerated, as only half of the tests are necessary.
Thanks in advance for your support,
Kind regards
1 Comment
deejt
on 3 Jun 2021
I was wondering about the same.
Also I was wondering how do I know in case of a small p-value, which of the factor levels, in this case I vs II, had the positive impact on Cate since its the same comparison in both lines?
Thank you for your help!
Answers (0)
See Also
Categories
Find more on Analysis of Variance and Covariance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!