Performing a complete post-hoc test for repeated measures with between-subject variable
Show older comments
I'd like to perform a complete post-hoc test for a repeated measures ANOVA with a between-subject variable but multcompare only gives one comparison, how can I extend this?
These are my variables: One between-subject variable: group = ['A' 'B' 'A' 'B', etc.]; One within-subject variable: session = [1 2]; One dependent variable: myDV = [DV's measured in session 1, DV's measured in session 2];
This is what I did: t = table(group,myDV(:,1),myDV(:,2),'VariableNames',{'group','s1','s2'}); rm = fitrm(t,'s1-s2 ~ group','WithinDesign',session); anovaTbl = ranova(rm) postHoc = multcompare(rm,'group')
And this is what I got: anovaTbl = SumSq DF MeanSq F pValue pValueGG pValueHF ________ ________ _____ _______ _______ _______
(Intercept):Time 0.00089949 1 0.00089949 0.51383 0.47534 0.47534 0.47534
group:Time 0.014897 1 0.014897 8.5099 0.0044594 0.0044594 0.0044594
Error(Time) 0.15755 90 0.0017506
postHoc = group_1 group_2 Difference StdErr pValue Lower Upper _____ _____ ________ _______ ________ ______ ______
'A' 'B' 0.16178 0.0095257 1.0599e-10 0.14286 0.18071
'B' 'A' -0.16178 0.0095257 1.0599e-10 -0.18071 -0.14286
So, I got a group x session interaction effect (which is what I expected). Now, I'd like to see where that effect is coming from but multcompare only gives me the post-hoc comparison between group A and group B over the two sessions taken together. How can I extend this to include the comparisons between group A and B for session 1 and session 2 taken separately AND the comparison for group A between sessions and group B between sessions?
Thanks!
4 Comments
KW
on 21 Jul 2020
postHoc = multcompare(rm,'group','By','session')
Kamil Vlcek
on 24 Jul 2020
Hello,
In a similar way I tried procedure for repeated measures ANOVA described here
The essential part of the code being
rm = fitrm(tbiases,'V1-V30~1','WithinDesign',within);
[ranovatblb] = ranova(rm, 'WithinModel','HRs*VisualFeedback*ObstaclePos');
Mrm1 = multcompare(rm,'HRs','By','VisualFeedback','ComparisonType','tukey-kramer');
Then I compared the results with the same data analyzed by STATISTICA. The ranova results (F values etc) fit well, but the post hoc test does not. In STATISTICA I used post-hoc Tukey HSD, that should be the same as 'ComparisonType','tukey-kramer' in multcompare.
What could be the reason?
Thanks!
Anne Bierbrauer
on 10 Feb 2021
Hi!
This question was asked long ago, but I stumbled upon the same issue today.
Using multcompare to calculate the within subject simple effects from a mixed ANOVA works perfectly well. However, for the between subject simple effects, it seems that the standard errors and the dfs are not pooled across groups, but calculated for each group (as if the between subject factor was a within subject factor). I therefore get a discrepancy if I compare the results to the same analysis in R.
Help would be very much appreciated cause I want to use Matlab (instead of R) to do permutation statistics and I rely on the correct post-hoc simple effects for that.
Best
Anne
Scott MacKenzie
on 29 Jul 2021
It might help of you provide an example, via code and data. of what you are observing.
Answers (0)
Categories
Find more on ANOVA 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!