Problem using ranova for analysis of variance
5 views (last 30 days)
Show older comments
Scott MacKenzie
on 22 Jul 2021
Edited: Scott MacKenzie
on 27 Jul 2021
I'm trying to use ranova to analyse data from a fairly simple experiment, but am not successful as yet. The data (60x3) are attached. There were 60 teenage participants. The 1st column contains the measures on the dependent variable, grip strength. The 2nd and 3rd columns contain grouping codes for two independent variables, gender (m, f) and dietary group (dg1, dg2, dg3). So, there were 2x3=6 groups with 10 participants per group.
ranova seems to be the most flexible and powerful of MATLAB's anova functions, and I've had success with it in the past. But I'm coming up empty so far with this design. Here's the code I'm using:
T = readtable('testdata.txt');
T.Properties.VariableNames = {'DV', 'Gender', 'DietaryGroup' };
rm = fitrm(T,'DV ~ Gender-DietaryGroup','WithinDesign',table(1,'VariableNames',{'GripStrength'}));
AT = ranova(rm, 'WithinModel', 'GripStrength')
The output table includes an effect for gender but not for dietary group. As usual for a design like this, I need a main effect for each independent variable and also the interaction effect.
AT =
6×8 table
SumSq DF MeanSq F pValue pValueGG pValueHF pValueLB
________________ __ ________________ ________________ ____________________ ____________________ ____________________ ____________________
(Intercept) 132155.818801667 1 132155.818801667 1710.03811173231 9.71642961217613e-45 9.71642961217613e-45 9.71642961217613e-45 9.71642961217613e-45
Gender 783.442935000001 1 783.442935000001 10.1374066565166 0.00233737408952656 0.00233737408952656 0.00233737408952656 0.00233737408952656
Error 4482.37816333333 58 77.2823821264368
(Intercept):GripStrength 132155.818801667 1 132155.818801667 1710.03811173231 9.71642961217613e-45 9.71642961217613e-45 9.71642961217613e-45 9.71642961217613e-45
Gender:GripStrength 783.442935000001 1 783.442935000001 10.1374066565166 0.00233737408952656 0.00233737408952656 0.00233737408952656 0.00233737408952656
Error(GripStrength) 4482.37816333333 58 77.2823821264368
Any help you can offer is greatly appreciated.
0 Comments
Accepted Answer
Peter Perkins
on 26 Jul 2021
Scott, haven't you explicitly not included DietaryGroup with that minus sign? I think you are using it for predictors in a way that's only valid in the response specification.
3 Comments
Peter Perkins
on 27 Jul 2021
I'm afraid ranova goes beyond my knowledge. I assume by "garbage" you mean "unrealistic estimates", and not "those lines should not be there".
More Answers (0)
See Also
Categories
Find more on Repeated Measures and MANOVA 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!