[R-sig-ME] Model failed to converge when a factor is centered or releveled

Chao Han h@nch@o @end|ng |rom ude|@edu
Sun Mar 10 03:26:51 CET 2019


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?

Thank you in advance for your help.

Best,
Chao

	[[alternative HTML version deleted]]



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