How to do ANOVA repeated measures?
Mostra commenti meno recenti

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 Commenti
Scott MacKenzie
il 30 Apr 2023
Modificato: Scott MacKenzie
il 30 Apr 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
il 1 Mag 2023
Scott MacKenzie
il 1 Mag 2023
Modificato: Scott MacKenzie
il 1 Mag 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.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Repeated Measures and MANOVA in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

