# Why am I seeing 0 degrees of freedom when testing main effects using lme4, but see 1 df when testing interaction?

So sorry if this is a dumb question, but I've been searching around and can't figure out what's going on. I'm running a mixed effect model with 2 fixed effects and random intercepts, as shown below. The fixed effects are 2 level factors.

sluice_lm <- lmer(response ~ length * type + (1 | subject) + (1 | item), data = sluice)

Linear mixed model fit by REML ['lmerMod']
Formula: response ~ length * type + (1 | subject) + (1 | item)
Data: sluice

REML criterion at convergence: 3619.8

Scaled residuals:
Min      1Q  Median      3Q     Max
-3.2979 -0.5936  0.1012  0.6386  3.8323

Random effects:
Groups   Name        Variance Std.Dev.
subject  (Intercept) 1.349    1.1615
item     (Intercept) 0.102    0.3194
Residual             1.995    1.4125
Number of obs: 984, groups:  subject, 41; item, 24

Fixed effects:
Estimate Std. Error t value
(Intercept)               4.057550   0.212889  19.059
lengthshort               0.920168   0.128109   7.183
typeargument             -0.185700   0.127849  -1.452
lengthshort:typeargument  0.008182   0.181173   0.045

Correlation of Fixed Effects:
(Intr) lngths typrgm
lengthshort -0.301
typeargumnt -0.300  0.501
lngthshrt:t  0.213 -0.707 -0.709


When I use run anovas using the update function to test the main effects and the interaction between them I have some uninterpretable results—the interaction returns a 'normal' result, however the anovas for the main effects result in 0 degrees of freedom, shown below:

update(sluice_lm, . ~ . - length:type, REML = F): response ~ length + type + (1 | subject) + (1 | item)
sluice_lm: response ~ length * type + (1 | subject) + (1 | item)
Df    AIC    BIC  logLik deviance  Chisq Chi Df Pr(>Chisq)
update(sluice_lm, . ~ . - length:type, REML = F)  6 3622.9 3652.3 -1805.5   3610.9
sluice_lm                                         7 3624.9 3659.1 -1805.5   3610.9 0.0021      1     0.9637

sluice_lm: response ~ length * type + (1 | subject) + (1 | item)
update(sluice_lm, . ~ . - length, REML = F): response ~ type + (1 | subject) + (1 | item) + length:type
Df    AIC    BIC  logLik deviance Chisq Chi Df Pr(>Chisq)
sluice_lm                                    7 3624.9 3659.1 -1805.5   3610.9
update(sluice_lm, . ~ . - length, REML = F)  7 3624.9 3659.1 -1805.5   3610.9     0      0          1

sluice_lm: response ~ length * type + (1 | subject) + (1 | item)
update(sluice_lm, . ~ . - type, REML = F): response ~ length + (1 | subject) + (1 | item) + length:type
Df    AIC    BIC  logLik deviance Chisq Chi Df Pr(>Chisq)
sluice_lm                                  7 3624.9 3659.1 -1805.5   3610.9
update(sluice_lm, . ~ . - type, REML = F)  7 3624.9 3659.1 -1805.5   3610.9     0      0          1


I'm really quite confused as to what is going on. I have run essentially identical code on an extremely similar data set which did not exhibit this kind of result. I've been going back over all the code as well as the experimental items which generated these results and can't find anything anomalous.

New contributor
kgh is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• I am cannot tell how these models differ based on the update command. Can you run the models separately, as new model objects. That is, run a model (sluice_lm1) that has just the main effects without the interaction and then run anova(sluice_lm, sluice_lm1). Likewise for your other models. It's just easier to see what's going on when they are separate. – Erik Ruzek Feb 14 at 2:45
• Note that your top model was fit by REML while you specify "REML=F" in the calls to "update." Is that the correct way to do this? – EdM Feb 14 at 18:07