I am trying to fit a generalised mixed effects model, but I am having convergence problems. The model I want to fit is
mod2 <- glmer(accuracy ~ reps * time + (1 | ID) + (1 | item),
family = 'binomial',
data = xdata)
The error I have is this one:
Warning message:
In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0167064 (tol = 0.001, component 1)
My predictors are time and number of repetitions. Time levels are immediate, 1 day and 1 week. The number of repetitions are 2, 4 or 6. I thought these should be treated as categorical, but now I'm not sure.
I have 240 observations at each combination of time/number of repetitions. I have 20 participants at each number of repetitions (between subjects design) and all of them were tested at the 3 time intervals (within subjects). I have 36 items, and a different subset of 12 was tested at each time delay. The order of these subsets was randomised across participants.
Most people I asked told me to scale my predictors and if this does not work, to try and optimiser such as bobyqa.
I tried to scale them in R but I get this error:
Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric
That makes me think it is not even possible to scale them. Should I make the continuous even if I only have three points for each one?
Because the subjects are nested within the number of repetitions, another solution could be to add (1 | reps:ID) but I don't know if it makes sense.
Thank you for reading!
glmer()
, not just the warning message. In particular, what type of generalized model are you trying to use? Also, please give some indication about the nature of the data: how many observations at each combination of time/number of repetitions, how many individuals your mixed effect(s) are trying to take into account. Scaling shouldn't generally be used or needed for categorical predictors unless you are using some type of penalization method like ridge regression or LASSO. $\endgroup$ID
s do you have ? Did you try a different optimiser ? You could also try the packageGLMMAdaptive
instead oflme4
$\endgroup$