[R-sig-ME] Testing all random-effects correlations in lme4

Timothy MacKenzie |@w|@wt @end|ng |rom gm@||@com
Fri Mar 11 05:27:36 CET 2022


Dear All,

Am I right that to test whether each correlation estimate in G (below)
is 0 or not, the only way is to have a full model and then fit
different models each time fixing a correlation estimate to 0 and then
compare the fit of the full model to the model whose target
correlation estimate has been fixed to 0?

Is there any quicker way not to repeat this process manually so many times?

Thanks,
Tim M

library(lme4)

dat <- read.csv("https://raw.githubusercontent.com/fpqq/w/main/d.csv")

form3 <- y ~ item_type*time + (0 + item_type | user_id)

full_model <- glmer(form3, family = binomial, data = dat,
            control =
              glmerControl(optimizer = "bobyqa",
                           optCtrl=list(maxfun=1e4)))

G <- VarCorr(full_model)

attr(G$user_id, "correlation")



More information about the R-sig-mixed-models mailing list