[R] Sums of sq in car package Anova function

Karla Sartor ksartor at montana.edu
Sun Dec 19 00:43:08 CET 2004

Hello R users,

I am trying to run a three factor ANOVA on a data set with unequal 
sample sizes.

I fit the data to a 'lm' object and used the Anova function from the 
'car' package with the 'type=III' option to get type III sums of 
squares.  I also set the contrast coding option to 'options(contrasts = 
c("contr.sum", "contr.poly"))' as cautioned in Jon Fox's book "An R and 
S-plus Companion to Applied Regression'.

Is there anything else that I need to consider when using the type III 
option with the Anova function?

When I run the same data set in SPSS with General Linear Model and type 
III  sums of squares, the sums of squares are different enough that one 
of the main effect terms is significant in the R table and not in the 
SPSS table.  I found a similar discrepancy with a different data set, 
only SPSS showed a significant interaction effect while, while the 
'Anova' function did not.

I also compared the results from SPSS those from the 'anova' function in 
the base package, and the results are nearly identical.  I would expect 
the two methods with type III sums of squares to be more similar, does 
anyone have any ideas as to why that was not the case?  I am hoping to 
not go back to SPSS at this point, so am trying to decide which of the 
two R functions is most appropriate for me (and defensible, considering 
the unequal sample sizes).

Thank you in advance for any ideas you may have!


Karla Sartor
Montana State University - LRES
ksartor at montana.edu

More information about the R-help mailing list