0
$\begingroup$

I'm running a mixed-effects model using glmer() function. The modeling works well 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.

The data is here.

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 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 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)
$\endgroup$
  • $\begingroup$ I tried all three versions of your model with lme4::glmer and none converged. Did you specify any additional arguments? $\endgroup$ – dipetkov Mar 3 at 21:05
  • $\begingroup$ No, I didn't. I just downloaded the data and tried the above exact codes again, and I got the same problem as described above: The first version did not give a warning message about converge, but the rest two versions did. $\endgroup$ – mooninnap Mar 5 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.