The age old question of comparing sums of squares (SS) between programs has reared its ugly head again.
I am trying to replicate output in SPSS, that was computed using Type 3 Sums of Squares, in R.
I understand that with multiple regressions, there are several ways to get Type 3 SS in R (to match Type 3 output from SPSS).
However, I am running a mixed model using aov (which uses Type 1 SS) and even when I try all the "usual" fixes," my estimates don't match the Type 3 SS output from SPSS.
First of all, when I run the SPSS syntax using "/METHOD=SSTYPE(1)" the results match those I get using this code:
mymodel<-aov(data=longdat, DV ~ 1 + Task + Cue + Compatibility + Cue:Task + Compatibility:Task + Cue:Compatibility + Cue:Compatibility:Task + Error(subject/Cue/Compatibility/Cue*Compatibility))
summary(mymodel)
So I know the analyses are the same when they use Type 1 SS.
However, when I use:
options(contrasts = c("contr.sum","contr.poly"))
tt<-lm(DV ~ 1 + Task + Cue + Compatibility + Cue:Task + Compatibility:Task + Cue:Compatibility + Cue:Compatibility:Task + 1/subject/Cue/Compatibility /(Cue*Compatibility), data=longdat)
drop1(tt, ~., test="F")
The results do not match the SPSS Type 3 output.
In attempts to get matching output, I have also tried the Anova function (which can give Type 3 SS)
Anova(mymodel, type=3, test.statistic="F")
but I get this error "Error in terms.formula(formula, data = data) : 'data' argument is of the wrong type."
I have also tried using lmer
.
Can someone help me get Type 3 Sums of Squares for a mixed model in R?
Thank you!
Type-III
so it is more obvious what you are asking for. I hope you do not mind, please feel free to change it too.) $\endgroup$