2 x 2 mixed ANOVA

22 ビュー (過去 30 日間)
Kim
Kim 2020 年 6 月 7 日
回答済み: Scott MacKenzie 2021 年 8 月 4 日
Hello MATLAB experts,
Recently, I am trying to conduct two-way mixed ANOVA using MATLAB2020a. Before using the code, I would like to confirm with you whether my code is correct. Also, I have several questions.
Two groups ('A', 'B') and each (independent) subject of each group conducted twice experiment repeatedly with a week interval. So, I denoted as the Pre and Post ("sessions").
dataTable =[];
dataX = [rand(14,2) [zeros(7,1); ones(7,1)]];
dataTable = array2table(dataX);
dataTable.Properties.VariableNames = {'Pre','Post','Group'};
dataTable.Group = categorical(dataTable.Group);
wsVariable = table([0 1]','VariableNames',{'Session'});
rm = fitrm(dataTable,'Pre,Post~Group','WithinDesign',wsVariable);
ranovatbl = ranova(rm);
multcompare(rm,'Session')
anovatbl = anova(rm);
multcompare(rm,'Group')
I would like to conduct the multiple comparison (1) between pre and post in each group, (2) between groups given each session, and (3) of interaction.
For instance, groupA: pre vs. post, groupB: pre vs. post, Pre: groupA vs. groupB, Post: groupA vs. groupB and so on.
However, this code doesn't work what I wanted.
In addition, there are any ways to conduct non-parametric 2 x 2 mixed ANOVA using the dataset??
It would be very appreciated if you let me know how to fix this.
Many thanks

回答 (1 件)

Scott MacKenzie
Scott MacKenzie 2021 年 8 月 4 日
It makes no sense to use multcompare here since there are only two "sessions" and only two "groups". multcompare is used when there are >2 conditions to compare.
Other than that, the code is mostly fine. One issue is that the call to ranova, as is, only generates the Group x Session interaction effect. In order to also get the main effect for Group and the main effect for Session, "WithinModel" is needed:
ranovatbl = ranova(rm, 'WithinModel', 'Session');

カテゴリ

Help Center および File ExchangeAnalysis of Variance and Covariance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by