On Sep 12, 2019, at 2:14 PM, Kevin Chu <kevin.m.chu at duke.edu> wrote:
Hello,
I built a linear mixed effects model with three fixed factors and one random factor. I want to test for statistical significance of the fixed effects using F-tests from a type III ANOVA table. Since I am using a type III ANOVA, I understand that I need to set the contrasts to contr.sum so that the sums of squares are calculated correctly.
These are the data types.
'data.frame': 280 obs. of 5 variables:
$ SUBJECT : Factor w/ 20 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
$ CONDITION: Factor w/ 4 levels "anechoic","aula",..: 1 1 1 1 2 2 2 2 3 3 ...
$ CHANNEL : Factor w/ 2 levels "0","1": 1 1 2 2 1 1 2 2 1 1 ...
$ STRATEGY : Factor w/ 2 levels "0","1": 1 2 1 2 1 2 1 2 1 2 ...
$ SCORE : num 107.4 57 90.1 96.1 -16.4 ...
Below is the code I used to generated the model.
lmm <- lmer(SCORE ~ CONDITION * CHANNEL * STRATEGY + (1 | SUBJECT), data=mydata, contrasts=list(CONDITION=contr.sum, CHANNEL=contr.sum, STRATEGY=contr.sum))
I tried passing lmm through anova from the stats package and Anova from the car package, but I obtained different results (screenshots are attached).
My questions:
1) Why do anova and Anova give different results even though I specified type III ANOVA?
2) Why is the Sum Sq equal to 0 in the table produced by anova?
I would prefer not to release the data as I plan to publish a paper based on my results, but if it helps I can create dummy data.
Thank you,
Kevin Chu
<Anova_car.png><anova_stats.png>_______________________________________________
R-sig-mixed-models at r-project.org mailing list