Problem using ranova for analysis of variance

3 Ansichten (letzte 30 Tage)
Scott MacKenzie
Scott MacKenzie am 22 Jul. 2021
Bearbeitet: Scott MacKenzie am 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.

Akzeptierte Antwort

Peter Perkins
Peter Perkins am 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 Kommentare
Peter Perkins
Peter Perkins am 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".
Scott MacKenzie
Scott MacKenzie am 27 Jul. 2021
Bearbeitet: Scott MacKenzie am 27 Jul. 2021
OK, thanks for your follow-up on this point. I suppose "garbage" is a bit strong, but when I look at the tables generated by ranova, my response is... Ugh! What's going on here? There seems to be a mind-set issue here. I'm in that group of researchers that use the ananysis of variance to test for main effects and interaction effects in data collected in experimental research. We think about independent variables, dependent variables, and such. We're not thinking about building or testing prediction models with data collected in observational research or correlation research. The latter seems to be the mind set that comes with ranova.
For the design in my question, there are two between-subjects factors or independent variables. The anova table should provide the main effects and interaction effect for these two variables, and nothing more. To illustrate, here's the anova table for this same data set generated by JMP (from SAS Institute):
There is nothing unusual about the anova table above. It's what you get with pretty well any stats package and what you'll see in textbooks on statistical methods, research methods, etc.
The data in the table above are found in lines 2-5 in the table generated by ranova. The six additional lines in the table generated by ranova are just a nuisance in my view. I'd like to eliminate them, if possible. That's the essence of my follow-up question. Anyway, thanks again for your consideration on this issue and, in particular, for your answer to my question.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by