two way repeated measures anova

how to do a 2 way repeated measures anova with MATLAB? I need to perform a 2 way anova for a repeated measures data, each having 2 levels. I see anova2 is to be used for between subject designs and anovan when the design is unbalanced. Any advice would be of great help.

4 commentaires

Jeff Miller
Jeff Miller le 24 Juil 2020
See if this previous answer helps
Shamini Warda
Shamini Warda le 25 Juil 2020
Modifié(e) : Shamini Warda le 25 Juil 2020
Hi. Many thanks for this. this code works fine, but it gives different results. here is how i used it. I have 2 within subject factors, each having two levels.
levels were arranged column wise with 29 observations row wise for each levels
data = [li_l(:,1), li_s(:,1), si_l(:,1), si_s(:,1)];
datatable = array2table(data);
datatable.Properties.VariableNames = {'li_lr','li_sr','si_lr','si_sr'};
WithinFactors = table([1 1 2 2]',[1 2 1 2]','VariableNames',{'Interval','Response'});
rm = fitrm(datatable,'li_lr,li_sr,si_lr,si_sr~1','WithinDesign',WithinFactors);
ranovatable = ranova(rm,'WithinModel','Interval*Response');
any suggestions would be of immense help.
Thank you.
Jeff Miller
Jeff Miller le 25 Juil 2020
Different results than what?
You probably want to use the 'categorical' command to tell ranova that the numbers in WithinFactors represent arbitrary category labels rather than numerical values of some predictor.
Shamini Warda
Shamini Warda le 27 Juil 2020
It now works. Thank you very much.

Connectez-vous pour commenter.

Réponses (1)

Scott MacKenzie
Scott MacKenzie le 28 Juil 2021

1 vote

Visit this question for a simple approach to doing a two-way repeated measures (aka within-subjects) anova using the ranova function.

Produits

Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by