Set up Repeated Measures Anova function MATLAB
Show older comments
Hello Everyone,
I want to run an ANOVA comparing 3 treatments (labeled as 1, 2, and 3) and then run a post-hoc comparison between treatments if the ANOVA shows a difference. I have 16 individual patients who all receive 3 different treatments and each treatment has 3 independent measurements taken at the same time. Here is the code I have so far:
data = readtable('Data.xlsx') ;
% Removing the 'Patients' column
t = data(:,2:end) ;
% Within design
WithinDesign = table((1:3)','VariableNames',{'Measurements'}) ;
% Repeated measures model
rm = fitrm(t,'AA-FE~Treatment','WithinDesign',WithinDesign) ;
% Sphericity test
rm.mauchly
% Anova
ranova(rm)
I understand that the data does not pass the sphericity test caclulated by rm.mauchly, but I would still like to know whether or not my ANOVA set-up represents what I wanted to acquire from ANOVA since I would like to do this in the future.
3 Comments
Scott MacKenzie
on 22 Jul 2022
Edited: Scott MacKenzie
on 24 Jul 2022
@Jacob Jacobo I can help with the ANOVA and post hoc comparisons, but first I'd like to verify that I understand your design. Are AA, IE, and FE measurements taken for each treatment? You refer to them as "independent measurements", but they sound like dependent variables to me. That is, AA is a measurement that depends on the treatment (1, 2, or 3). The same can be said for IE and FE, if I understand correctly. Just a terminology thing, perhaps. Seems to me your independent variable is treatment, with levels 1, 2, and 3. So, I would characterize your design as a single-factor design with one within-subjects independent variable (treatment with levels 1, 2, and 3) and three dependent variables (AA, IE, and FE). Is this correct?
Jacob Jacobo
on 25 Jul 2022
Scott MacKenzie
on 25 Jul 2022
@Jacob Jacobo, thanks for the clarification. I just posted an answer. Good luck.
Accepted Answer
More Answers (0)
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!