Search code examples
rregressionlinear-regressionlme4mixed-models

lme4 version 1.1.26 no longer printing p values for fixed effects?


Here's my data: https://pastebin.com/ZgWHcrTi

I booted up R today and suddenly I can't get p-values from my regression models! lme4 version 1.1.26

I can still get them with sjPlot::tab_model(data$dv1, p.val = "kr")

library(lme4)

summary(lmer(dv1 ~ group + (1|id),
            data=data,
            REML=T))

Linear mixed model fit by REML ['lmerMod']
Formula: dv1 ~ group + (1 | id)
   Data: regression.data

REML criterion at convergence: 637.4

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-3.3455 -0.5839  0.0699  0.6999  2.0728 

Random effects:
 Groups    Name        Variance Std.Dev.
 id (Intercept)  2.189   1.479   
 Residual              62.981   7.936   
Number of obs: 92, groups:  id, 3

Fixed effects:
            Estimate Std. Error t value
(Intercept)   -7.749      1.412  -5.488
group1        -13.872      1.661  -8.351

Correlation of Fixed Effects:
          (Intr)
group1   -0.537

Solution

  • Not printing p-values has been a "feature" of lme4 forever (see here and here). I strongly suspect that you had the lmerTest package loaded before (which wraps the lme4 functions and gives identical output except for including a p-value column) and that you have failed/forgotten to load it in your current session ...

    library(lme4)
    coef(summary(m1 <- lmer(Reaction~Days + (Days|Subject), sleepstudy)))
    ##              Estimate Std. Error   t value
    ## (Intercept) 251.40510   6.824597 36.838090
    ## Days         10.46729   1.545790  6.771481
    library(lmerTest)
    coef(summary(m2 <- lmer(Reaction~Days + (Days|Subject), sleepstudy)))
    ##             Estimate Std. Error       df   t value     Pr(>|t|)
    ## (Intercept) 251.40510   6.824597 16.99973 36.838090 1.171558e-17
    ## Days         10.46729   1.545790 16.99998  6.771481 3.263824e-06
    

    If you've already fitted a model with lme4::lmer() you can get the p-values by loading lmerTest and converting the type: coef(summary(as(m1,"merModLmerTest")))

    You may want to be careful with your specifications: the default denominator-df in lmerTest is Satterthwaite, whereas your tab_model is using Kenward-Roger. (You can use summary(., ddf="Kenward-Roger") to get K-R degrees of freedom/p-values from lmerTest. Kenward-Roger is generally a little more accurate, but is slow to the point of infeasibility for large data sets, which is presumably why Satterthwaite is the default in lmerTest.)