From my understanding, the addition of a -1 in the fixed effects of a lmer() model would avoid comparisons of factor levels to a baseline (e.g. the (intercept) in the model summary). However, adding -1 to the fixed effects of the lmer() changes the df of the factor levels and ANOVA results (see code below). Does anyone know why this occurs? When should you code models with -1?
Prep
library(lmerTest)
mtcars$am<-as.factor(mtcars$am)
Traditional model
M1<-lmer(mpg~am*hp+(1|carb),data=mtcars)
summary(M1)
Estimate Std. Error df t value
(Intercept) 25.66172 2.28955 21.40909 11.208
am1 5.83594 2.61030 26.89064 2.236
hp -0.05230 0.01347 24.93249 -3.882
am1:hp -0.00412 0.01633 27.96768 -0.252
anova(M1)
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
am 40.696 40.696 1 26.891 4.9985 0.03387
hp 306.263 306.263 1 17.996 37.6171 8.597e-06
am:hp 0.518 0.518 1 27.968 0.0636 0.80271
No intercept model
M2<-lmer(mpg~-1+am*hp+(1|carb),data=mtcars)
summary(M2)
Estimate Std. Error df t value Pr(>|t|)
am0 25.66172 2.28955 21.40909 11.208 2.02e-10
am1 31.49766 1.65927 12.32171 18.983 1.71e-10
hp -0.05230 0.01347 24.93249 -3.882 0.000673
am1:hp -0.00412 0.01633 27.96768 -0.252 0.802705
anova(M2)
Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
am 3502.5 1751.26 2 18.422 215.1004 1.692e-13
hp 306.3 306.26 1 17.996 37.6171 8.597e-06
am:hp 0.5 0.52 1 27.968 0.0636 0.8027