Repeated measures ANOVA Matlab (Statistic)

조회 수: 49 (최근 30일)
Jakob Kruppa
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!
Thanks in advance

채택된 답변

Jeff Miller
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
Jakob Kruppa
Jakob Kruppa 2022년 1월 14일
Thanks for your quick reply!
But why does only one p-value come out?
Actually, groups A,B,C and D should each be tested with the other for significant change.
So A to B and A to C .... or B to C and so on. So there should be 7 p-values in total.
Also, I am still given a significant p-value<0.05 [pValue=2.5462e-31] if I change vectors A and B like this:
A = [10 10 10 10 10 10 10 10 10 10]';
B = [10 10 10 10 10 10 10 10 10 10]';
And what does the whole thing look like in addition with a post hoc test?
Thanks for the help in advance! :)
Jeff Miller
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).

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Repeated Measures and MANOVA에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by