Repeated measures ANOVA output not consistent with SPSS???

2 views (last 30 days)
Hi I am running a two way ANOVA in which both IVs (Filter type and Ground Clutter) are within-subject design
% I used Matlab with the following code to run repeated measures ANOVA
Operator = [1 2 3 4]';
D1 = [90 96 100 92]';
D2 = [86 84 92 81]';
D3 = [102 106 105 96]';
D4 = [87 90 97 80]';
D5 = [114 112 108 98]';
D6 = [93 91 95 83]';
tbl = table(Operator,D1,D2,D3,D4,D5,D6)
GroundClutter = {'L';'L';'M';'M';'H';'H'};
Filter = {'1';'2';'1';'2';'1';'2'};
WithinVariables = table(GroundClutter,Filter);
rm = fitrm(tbl,'D1-D6~1','WithinDesign', WithinVariables);
ranovatbl = ranova(rm,'WithinModel','GroundClutter*Filter')
The output is as follows:
Each variable has their own error term rather than classic ANOVA model which only has one term and the output from SPSS is as follows
You can see that the SS terms are same except the error term from SPSS output is the sum of the respective error terms (4,6,8 in the second figure). I am not sure what the intercept (1 in the second figure) mean, which is the between subject variable while I have include that in the model in order to run it... Can I remove that?
How to produce results using Matlab similar to the SPSS output?
  4 Comments
Jeff Miller
Jeff Miller on 26 Feb 2020
Sorry, I don't think I can help you. As I learned it the two-way repeated ANOVA model SS breakdown is
SStotal = SSu + SSa + SSb + SSab + SSsubject + SSa*subject + SSb*subject + SSa*b*subject
The 8 terms on the right correspond to the 8 lines in MATLAB's ANOVA table.
It looks to me like the SPSS output has dropped SSu entirely and combined SSa*subject + SSb*subject + SSa*b*subject into one overall SSerror. Maybe you can make MATLAB do the same thing by passing a 'WithinModel' statement to the fitrm command (maybe 'WithinModel','1'), but I am just guessing.
Feng Zhou
Feng Zhou on 26 Feb 2020
Thank you Jeff! I am teaching ANOVA and the subject factor is considered as random effect rather than fixed effect so we will not be interested in testing whether there is any significant difference between different individual subjects and also its interacdtion effects with other variables.
Thanks again and it seems ('WithinModel','1') not working. There might be a way to do it.
So I switched to SPSS and MiniTab and both produce what i wanted.
Thanks!

Sign in to comment.

Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!