[R-sig-ME] Model failed to converge when a factor is centered or releveled
David Duffy
D@v|d@Du||y @end|ng |rom q|mrbergho|er@edu@@u
Wed Mar 13 01:57:32 CET 2019
These jobs run for me giving those warnings, but when I plot the re's from both models they seem to be identical, and have converged to the same likelihood. I guess it is just that the contrast coding leads to numerical differences that upset the diagnostics,
________________________________________
From: R-sig-mixed-models [r-sig-mixed-models-bounces using r-project.org] on behalf of Chao Han [hanchao using udel.edu]
Sent: Sunday, 10 March 2019 12:26 PM
To: R-sig-mixed-models using r-project.org
Subject: [R-sig-ME] Model failed to converge when a factor is centered or releveled
Hi all,
I'm running a mixed-effects model using lmer4::glmer() function. The
modeling works with R's default dummy coding. But if I center or relevel a
factor of 2 levels, the model failed to converge. I am wondering why.
Here is the data:
https://www.dropbox.com/s/ysw5rvxowamucoh/example.csv?dl=0
Here is the code for the model without centering or releveling the factor
"Memory":
> model_default <- glmer(ACC ~ Memory * Group + (1|Subject) +
(1+Memory|item), family = "binomial", data = df)
The model converges with the above code. But the following model failed to
converge after centering the factor "Memory":
> c1 <- c(-0.5, 0.5)
> contrasts(df$Memory) = cbind(c1)
> model_center <- glmer(ACC ~ Memory * Group + (1|Subject) +
(1+Memory|item), family = "binomial", data = df)
If I relevel the factor "Memory", the following model failed to converge
either:
> df$Memory <- factor(df$Memory, levels = c("Y", "X"))
> model_relevel <- glmer(ACC ~ Memory * Group + (1|Subject) +
(1+Memory|item), family = "binomial", data = df)
Why would centering or releveling a factor make a difference in terms of
convergence? Which result should I trust?
More information about the R-sig-mixed-models
mailing list