How to do ANOVA repeated measures?
Afficher commentaires plus anciens

I have 12 Female and 11 Male rats which participate in a sucrose tracking experiment for 4 different levels of sucrose concentration. I have approach rate data (between 0 and 1) for each animal for 4 different concentration. I have attached the figure. I want to do ANOVA repeated measures for the experiment to check the effect of concentration as well as gender. I wrote this following code. But I'm not sure if this is correct or how to interpret the result.
dataForFemale = loadFile.featureForEachSubjectId{1};
dataForMale = loadFile.featureForEachSubjectId{2};
for i = 1:4
dataMatrix(:,i) = [dataForFemale{i} dataForMale{i}]';
end
Gender = [repmat({'F'},1,length(dataForFemale{1})),repmat({'M'},1,length(dataForMale{1}))]';
t = [Gender, array2table(dataMatrix)];
t.Properties.VariableNames = {'Gender','c1','c2','c3','c4'};
rm = fitrm(t, 'c1-c4 ~ Gender', 'WithinDesign', table([1, 2, 3, 4]','VariableNames', {'Concentration'}));
result = ranova(rm);
multcompare(rm, 'Concentration', 'By', 'Gender');
3 commentaires
Scott MacKenzie
le 30 Avr 2023
Modifié(e) : Scott MacKenzie
le 30 Avr 2023
Your ANOVA code is correct.
Bear in mind that you have a mixed design with one within-subjects factor (concentration with four levels) and one between-subjects factor (gender with two levels). The "repeated-measures" aspect of the ANOVA only pertains to concentration.
Atanu
le 1 Mai 2023
Scott MacKenzie
le 1 Mai 2023
Modifié(e) : Scott MacKenzie
le 1 Mai 2023
You're welcome. I just had another look and notice that you omitted the within-subjects IV (sucrose concentration) in the ranova function. I've added it, rearranged the code slightly, and posted an answer. Hope this helps.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Repeated Measures and MANOVA dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

