Skip to content

Normality of random effect not returned when using || #845

@mattansb

Description

@mattansb
fm1 <- lme4::lmer(Reaction ~ Days + (Days|Subject), data=lme4::sleepstudy)
performance::check_model(fm1)
Image

Same "model" but with (Days||Subject):

fm2 <- lme4::lmer(Reaction ~ Days + (Days||Subject), data=lme4::sleepstudy)
performance::check_model(fm2)
Image

This isn't an issue of multiple random grouping vars, seems unique to ||:

egsingle <- data.frame(
  schoolid = factor(rep(c("2020", "2820"), times = c(18, 6))),
  lowinc = rep(c(TRUE, FALSE), times = c(18, 6)),
  childid = factor(rep(
    c("288643371", "292020281", "292020361", "295341521"),
    each = 6
  )),
  female = rep(c(TRUE, FALSE), each = 12),
  year = rep(1:6, times = 4),
  math = c(
    -3.068, -1.13, -0.921, 0.463, 0.021, 2.035,
    -2.732, -2.097, -0.988, 0.227, 0.403, 1.623,
    -2.732, -1.898, -0.921, 0.587, 1.578, 2.3,
    -2.288, -2.162, -1.631, -1.555, -0.725, 0.097
  )
)

fm3 <- lme4::lmer(
  math ~ year + (year | childid) + (year | schoolid),
  data = egsingle
)
performance::check_model(fm3)
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug 🐛Something isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions