Conduct 2x3 repeated measures ANOVA using ranova()

2 views (last 30 days)
Dear all,
unfortunateley, I do not really understand the ranova function from Matlab. Let`s say I have created the following dummy RESULTS table
RESULTS =
20×7 table
SUBJ C1_A C1_B C1_C C2_A C2_B C2_C
________ ______ ______ ______ ______ ______ ______
'SUBJ1' 104.15 71.423 95.048 127.91 135.95 82.131
'SUBJ2' 103.48 76.25 94.809 97.269 113.05 80.021
'SUBJ3' 103.49 56.46 91.142 94.082 127.77 85.43
'SUBJ4' 92.708 72.839 95.96 88.426 124.5 72.077
'SUBJ5' 103.27 59.93 102.99 118.47 134.21 82.212
'SUBJ6' 94.851 80.454 101.65 157.41 134.53 81.195
'SUBJ7' 91.036 92.796 83.177 122.37 134.46 78.617
'SUBJ8' 87.967 86.064 99.72 96.858 126 89.569
'SUBJ9' 110.38 69.491 92.079 124.22 123.41 79.86
'SUBJ10' 91.541 55.542 83.933 90.818 123.51 88.784
'SUBJ11' 98.271 101.9 75.68 85.784 139.39 91.831
'SUBJ12' 87.913 110.75 97.764 122.2 109.62 83.902
'SUBJ13' 97.029 81.808 85.757 96.776 127.72 86.945
'SUBJ14' 67.68 65.151 90.557 115.37 132.97 89.477
'SUBJ15' 89.13 97.967 80.485 133.91 122.82 84.433
'SUBJ16' 85.736 71.11 71.394 116.82 135.25 88.786
'SUBJ17' 89.855 72.953 92.059 125.8 129.22 76.162
'SUBJ18' 97.867 93.296 89.254 82.701 119.68 92.773
'SUBJ19' 96.747 59.222 104.39 121.25 131.77 78.073
'SUBJ20' 119.44 50.649 99.62 146.35 127.05 72.198
by the following code:
C1_A = 10.*randn(20,1) + 100; C1_B = 15.*randn(20,1) + 80;
C1_C = 12.*randn(20,1) + 90; C2_A = 17.*randn(20,1) + 110;
C2_B = 11.*randn(20,1) + 130; C2_C = 7.*randn(20,1) + 85;
SUBJ = {};
for s=1:20
SUBJ = [SUBJ; ['SUBJ' num2str(s)] ];
end
RESULTS = table(SUBJ, C1_A, C1_B, C1_C, C2_A, C2_B, C2_C)
Based on this RESULTS table, how can I now know conduct a 2x3 repeated measures ANOVA with the two within subjects factors "Condition" (C1, C2) and "Measurement Time" (A, B, C)?
I would be very thankful for your help.

Answers (1)

Jeff Miller
Jeff Miller on 16 Jun 2019
% Describe within-Ss design:
WithinFacs = table([1 1 1 2 2 2]',[1 2 3 1 2 3]','VariableNames',{'C1','C2'});
% In the next line, '~1' indicates that there are no between-Ss factors.
rm = fitrm(RESULTS,'C1_A-C2_C~1','WithinDesign',WithinFacs);
[ranovatable, A, C, D] = ranova(rm,'WithinModel','C1*C2');
Also see related question for a little explanation.
  1 Comment
Jeff Miller
Jeff Miller on 20 Jun 2019
I no longer think this answer is correct. See related question link for further information.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!