Skip to content

A consultation about DF of the result of lmer

1 message · John Fox

#
Dear Rumeng He,

First, when you ask a question on the R-sig-ME list, it's polite to copy further messages to the list, as I've done with this response to your latest message.

Second, you don't say what model you fit to the sleepstudy data, so I'll answer by ESP:

Here I fit two models with lmer() to the sleepstudy data, one treating Days as a numeric predictor and one as a factor. You'll see that I get 1 df for the term in the first case and 9 in the second, as one would expect, which is what Ben Bolker and I both suggested:

--------------- snip ------------------
Loading required package: carData
Loading required package: Matrix
Registered S3 methods overwritten by 'lme4':
  method                          from
  cooks.distance.influence.merMod car 
  influence.merMod                car 
  dfbeta.influence.merMod         car 
  dfbetas.influence.merMod        car
Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ Days + (Days | Subject)
   Data: sleepstudy
REML criterion at convergence: 1743.628
Random effects:
 Groups   Name        Std.Dev. Corr
 Subject  (Intercept) 24.737       
          Days         5.923   0.07
 Residual             25.592       
Number of obs: 180, groups:  Subject, 18
Fixed Effects:
(Intercept)         Days  
     251.41        10.47
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: Reaction
      Chisq Df Pr(>Chisq)    
Days 45.843  1  1.281e-11 ***
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
[1] "0" "1" "2" "3" "4" "5" "6" "7" "8" "9"
Linear mixed model fit by REML ['lmerMod']
Formula: Reaction ~ DaysF + (1 | Subject)
   Data: sleepstudy
REML criterion at convergence: 1729.493
Random effects:
 Groups   Name        Std.Dev.
 Subject  (Intercept) 37.09   
 Residual             31.43   
Number of obs: 180, groups:  Subject, 18
Fixed Effects:
(Intercept)       DaysF1       DaysF2       DaysF3       DaysF4       DaysF5       DaysF6       DaysF7       DaysF8       DaysF9  
    256.652        7.844        8.710       26.340       31.998       51.867       55.526       62.099       79.978       94.199
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: Reaction
       Chisq Df Pr(>Chisq)    
DaysF 168.32  9  < 2.2e-16 ***
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
Analysis of Deviance Table (Type II Wald F tests with Kenward-Roger df)

Response: Reaction
           F Df Df.res    Pr(>F)    
DaysF 18.703  9    153 < 2.2e-16 ***
---
Signif. codes:  0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1

--------------------- snip ---------------

So what's the problem?

John