2 x 2 mixed ANOVA

조회 수: 21 (최근 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 CenterFile Exchange에서 Analysis 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