Repeated measures ANOVA output not consistent with SPSS???

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

Each variable has its own error term because it is a within-Ss design. The "classic" ANOVA with a single error term is for a between-Ss design, and that is what the SPSS output is giving you.
So, which design do you really want, between or within?
I think whether it is a between-subject design or a within-subject design, it should have only one error term. Here the error term i mean SSerror due to random error.
The example above is a two-way repeated ANOVA and the
SStotal = SSa + SSb + SSab + SSsubject + SSerror,
where SSa is the sum of square due to factor a (Ground Clutter),
SSb is the sum of square due to factor b (Filter Type),
SSab is the sum of square due to interaction between a and b,
SSsubject is the sum of square due to subject and what is left is SSerror, i.e., sum of square due to random error.
The matlab output Error in Row 2 is corresponding to SSsubject
(Intercept):GroundClutter in Row 3 is SSa, (Intercept): Filter in Row 5 is SSb, and (Intercept):GroundClutter:Filter in Row 7 is SSab.
Note the sume of Error(GroundClutter) in Row 4, Error(Filter) in Row 6 and Error(GroundClutter:Filter) is equivalent to the Error term in Row 6 in Figure 3 which is 166.3333.
The question is the F value should be calculated based on this overal SSerror term rather than their individual error term, which confuses me in the Matlab output. However, the matlab coding could be wrong here...
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.
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

Asked:

on 24 Feb 2020

Commented:

on 26 Feb 2020

Community Treasure Hunt

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

Start Hunting!