Search code examples
rlme4

sjt.lmer displaying incorrect p-values


I've just noticed that sjt.lmer tables are displaying incorrect p-values, e.g., p-values that do not reflect the model summary. This appears to be a new-ish issue, as this worked fine last month?

Using the provided data and code in the package vignette

library(sjPlot)
library(sjmisc)
library(sjlabelled)
library(lme4)
library(sjstats)

load sample data

data(efc)

prepare grouping variables

efc$grp = as.factor(efc$e15relat)
levels(x = efc$grp) <- get_labels(efc$e15relat)
efc$care.level <- rec(efc$n4pstu, rec = "0=0;1=1;2=2;3:4=4", 

val.labels = c("none", "I", "II", "III"))

data frame for fitted model

mydf <- data.frame(
  neg_c_7 = efc$neg_c_7,
  sex = to_factor(efc$c161sex),
  c12hour = efc$c12hour,
  barthel = efc$barthtot,
  education = to_factor(efc$c172code),
  grp = efc$grp,
  carelevel = to_factor(efc$care.level)
)

fit sample models

fit1 <- lmer(neg_c_7 ~ sex + c12hour + barthel + (1 | grp), data = mydf)
summary(fit1)
p_value(fit1, p.kr =TRUE)

model summary

model summary

p_value summary

p_value summary

sjt.lmer output does not show these p-values??

sjt.lmer summary


Solution

  • Note that the first summary comes from a model fitted with lmerTest, which computes p-values with df based on Satterthwaite approximation (see first line in output).

    p_value(), however, with p.kr = TRUE, uses the Kenward-Roger approximation from package pbkrtest, which is a bit more conservative.

    Your output from sjt.lmer() seems to be messed up somehow, and I can't reproduce it with your example. My output looks ok:

    enter image description here