How to do ANOVA repeated measures?
古いコメントを表示

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 件のコメント
Scott MacKenzie
2023 年 4 月 30 日
編集済み: Scott MacKenzie
2023 年 4 月 30 日
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
2023 年 5 月 1 日
Scott MacKenzie
2023 年 5 月 1 日
編集済み: Scott MacKenzie
2023 年 5 月 1 日
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.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Repeated Measures and MANOVA についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

