Dear List,
This is a logistic GLMM with 1 grouping factor + 8 fixed-effect covariates.
One of the fixed effects, namely x2, has three unordered categories. This
is the covariate for whose 2 non-reference categories I want to estimate
random slopes, along with the random intercepts with which I don't expect
the slopes to be correlated. But I fail:
*> VarCorr(glmer(y ~ (x2||id) + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8,
family = binomial, data = mydata, control = glmerControl(optimizer =
"optimx", optCtrl = list(method = "nlm")), nAGQ = 1))*
*boundary (singular) fit: see help('isSingular')*
* Groups Name Std.Dev. Corr id (Intercept) 0.00000
id.1 x2A 0.76331 x2B 0.75422
0.931 x2C 0.56139 0.807 0.967*
^ Why is it reporting correlations when I told it not to? And why is it
reporting the intercept variance as zero (which is wholly implausible)? And
why is it reporting a "random slope" for the reference category of x2? It's
the reference category, for crying out loud! It's not supposed to get an
estimate.
Consultation of the lme4 manual
<https://cran.r-project.org/web/packages/lme4/vignettes/lmer.pdf> (page 7)
suggests the following alternative syntax for specifying random slopes
uncorrelated with the random intercepts:
*> VarCorr(glmer(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + (1|id) +
(0+x2|id), family = binomial, data = mydata, control =
glmerControl(optimizer = "optimx", optCtrl = list(method = "nlm")), nAGQ =
1))*
*boundary (singular) fit: see help('isSingular')*
* Groups Name Std.Dev. Corr id (Intercept) 0.00000
id.1 x2A 0.76331 x2B 0.75422
0.931 x2C 0.56139 0.807 0.967*
^ The exact same strangeness persists. Correlations are being estimated
against my wishes, and there's a nonsensical parameter supposedly
ostensibly representing the reference category, plus an implausible zero
value reported on the random intercepts. What am I doing wrong?
Best,
Juho