I'm expanding on a helpful question/answer I found here: http://www.mathworks.com/matlabcentral/answers/124353-does-fitrm-ranova-support-within-subject-models-without-between-subject-factors
I have run a 3-way repeated measures ANOVA with 3 within subject factors. I want to make the pairwise comparisons for the 2- and 3-way interactions; I can run these for the 2-way interactions using the method RepeatedMeasuresModel/multcompare but I cannot figure out how to do it for the 3-way interaction. Here is my example:
% generate random data for the example
alpha_power = randn(24,8);% Create a table storing the respones
varNames = {'Y1','Y2','Y3','Y4','Y5','Y6','Y7','Y8'};t = array2table(alpha_power,'VariableNames',varNames);% Create a table reflecting the within subject factors 'TestCond', 'Attention', and 'TMS' and their levels
factorNames = {'TestCond','Attention','TMS'};within = table({'M';'M';'M';'M';'N';'N';'N';'N'},{'A';'A';'V';'V';'A';'A';'V';'V'},{'T';'S';'T';'S';'T';'S';'T';'S'},'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','TestCond*Attention*TMS');% make pairwise comparisons for the two-way interactions
%
% see: help RepeatedMeasuresModel/multcompare
multcompare(rm,'TestCond','By','Attention')multcompare(rm,'TestCond','By','TMS')multcompare(rm,'Attention','By','TMS')% but how can I make pairwise comparisons for the 3-way interaction?
%% this does not work (it ignores the 'Attention' factor)
multcompare(rm,'TestCond','By','Attention','By','TMS')
I found this old discussion, but it was not helpful (it refers to the standalone multcompare function): http://www.mathworks.com/matlabcentral/answers/2141-how-to-obtain-p-values-for-all-pair-wise-comparisons-from-the-multicompare-function
Is it possible to test the pairwise comparisons in the 3-way interaction?
Best Answer