Using ranova and multcompare, ranova doen't show significance (p=0.33) but multcompare shows significance between groups (p<0.001)

24 views (last 30 days)
I have some data with 3 treatment groups, and measurements taken at 2 time points. I'm trying to run a repeated measures ANOVA to look for differences in treatment groups. Using ranova, there seems to be no difference in groups (p=0.33), but when I use multcompare, there are definitley differences (p<0.001). I know this can happen if you are close to the significance threshold, but p=0.33 is pretty far from significance and p<0.001 is pretty significant.
Am I doing something wrong? I've never seen this much disagreement before. Any help would be greatly appreciated.
data = [17.6083111640726,8.09130862395186;16.6511819504569,8.00761730583739;19.3829655166727,9.48582943526035;17.2486684843076,9.17660070256173;19.2533401988935,9.49946417012892;16.0699825907708,7.71081640538386;23.3803045904050,18.1526587426930;20.3215049937154,25.1214584399104;33.2219612146310,14.9748347034811;20.3481771572960,12.0061682693401;20.2882873157905,12.7681533485691;21.9027839940461,17.1001217428395;19.5183979203687,13.4007740576720;23.9390980145993,16.2673068424496;25.4668268286170,14.6077783087918;24.2185363571440,13.8839482623856;24.0865379412008,14.1147485104799;23.1980236349000,12.5993290275684;25.0720124038387,15.0139697565871];
IndVar = ['a'; 'a'; 'a'; 'a'; 'a'; 'a'; 'b'; 'b'; 'b'; 'b'; 'b'; 'b'; 'b'; 'c'; 'c'; 'c'; 'c'; 'c'; 'c'];
t = table(IndVar,data(:,1),data(:,2),'VariableNames',{'IndVar','t1','t2'});
Time = table([1 2]','VariableNames',{'Time'});
rm = fitrm(t,'t1-t2 ~ IndVar','WithinDesign',Time);
ranovatbl = ranova(rm)
results=multcompare(rm,'IndVar')

Accepted Answer

Jeff Miller
Jeff Miller on 12 Apr 2021
Note that your anova table doesn't have enough lines--there is no main effect of IndVar, just the IndVar*Time interaction (p=0.33). You also need to tell ranova about the within factor, like this:
ranovatbl = ranova(rm,'WithinModel','Time')

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!