Open
Description
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...)