# Repeated measures ANOVA Matlab (Statistic)

조회 수: 1(최근 30일)
Jakob Kruppa 2022년 1월 13일
댓글: Jeff Miller 2022년 1월 15일
Hi guys,
I need urgent help from you guys for my Thesis!
following situation:
I have to program an anova with measurement repetitions for statistics.
In total, 10 subjects have tested 4 conditions (A, B, C and D), so this results in 10 measurements per condition. All results are pure numerical values, in my case acceleration values.
The whole Data thing looks quite simple in Matlab, e.g. as an array:
A = [10 11 13 16 15 18 17 16 11 12]
B = [20 22 21 25 24 23 22 20 28 26]
C = [49 48 45 46 47 49 40 48 47 45]
D = [70 60 65 66 69 64 62 63 69 67]
My supervisor has now told me that I should evaluate the whole thing with anova with measurement repetitions to test the individual groups among themselves for significance.
Of course, I tried to read up on it and came across the ranova function. However, I don't understand all the, in my opinion, much more complex examples....
Can anyone help me out? This would save my week!

댓글을 달려면 로그인하십시오.

### 채택된 답변

Jeff Miller 2022년 1월 14일
% Note the transpose operator: single-column vectors are more convenient.
A = [10 11 13 16 15 18 17 16 11 12]';
B = [20 22 21 25 24 23 22 20 28 26]';
C = [49 48 45 46 47 49 40 48 47 45]';
D = [70 60 65 66 69 64 62 63 69 67]';
% Load the data into a single array...
data = [A, B, C, D];
%...and convert it to a table which is slightly easier to work with (imo).
tbl = array2table(data,'VariableNames',{'A','B','C','D'});
% Fit the linear model
rm = fitrm(tbl,'A-D~1');
% print the ANOVA table
ranova(rm)
The conditions A-D are significantly different as one can see looking at the numbers, in this case with p value 3.9581e-25
##### 댓글 수: 2표시숨기기 이전 댓글 수: 1
Jeff Miller 2022년 1월 15일
Only one p value comes out because the null hypothesis under test says "the true means are identical in all four conditions". That's also why you still get a very small p with your revised A and B: there are still clear differences among ABCD even with those A & B values.
Use the 'multcompare' function if you want the pairwise comparisons A vs B, A vs C, etc. These are the post hoc tests it sounds like you might want. The command for that is
s = multcompare(rm,'Time')
(Time is the default name for your conditions factor comparing ABCD).

댓글을 달려면 로그인하십시오.

### Community Treasure Hunt

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

Start Hunting!

Translated by