Skip to content

Understanding the “standard errors are probably not reliable” warning message when fitting mixed models via lme4 #526

@annahuynhly

Description

@annahuynhly

Running these lines of code:

library(lme4)
library(modelbased)
fm1 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
estimate_means(fm1, by= "Subject")

Will produce the following warning message:

Standard errors are probably not reliable. This can happen when random effects are
  involved. You may try `estimate_relation()` instead. You may also try package
  glmmTMB to produce valid standard errors.

That being said, we obtain the same error message if we use the suggested function:

estimate_relation(fm1, by = "Subject")

My main question is: why is it that when random effects are involved, the standard errors are deemed as unreliable?

Currently lme4::predict() has a reasonably reliable se.fit= argument for including the standard errors for prediction. This stackoverflow post discusses extracting the joint covariance matrix of random and fixed effects for merMod objects, and eventually obtaining the standard errors: https://stackoverflow.com/q/78923181/190277

(And my secondary less important question is: why was estimate_relation() suggested? This one could be ignorance on my part...)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions