I'm trying to fit logistic regression with formula like this:
mod <- glmer(response ~ factor1+factor2+numeric1+numeric2+numeric3+numeric4 +(1|factor3),
data=myDataset,family = binomial,
control=glmerControl(optimizer="bobyqa"))
Factor1 and factor2 are categorical variables with (5 and 2 categories). Factor3 is id of subject. The rest of predictors are numeric variables - all of them scaled with scale().
I am getting following error/warning:
Warning messages:
1: Some predictor variables are on very different scales: consider rescaling
2: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.406353 (tol = 0.001, component 1)
3: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model is nearly unidentifiable: very large eigenvalue
- Rescale variables?;Model is nearly unidentifiable: large eigenvalue ratio
- Rescale variables?
When I am trying to fit the model without factor1 and factor2 variables, model fits without complain, so I am assuming that problem is in my factor predictors. But I have no idea how to fix it. Should I recode my factor variables to dummy variables myself and then scale them? Will it help? Any idea will be very appreciated.
str(myDataset)
). How many observation do you have nested per person? How many individuals overall? And how much variability is there in your DV? Just curious in terms of trying to reproduce all of the conditions for this example. $\endgroup$scale(numeric1)+scale(numeric2)+scale(numeric3)+scale(numeric4)
instead ofnumeric1+numeric2+numeric3+numeric4
and see if rescale your numerical variables help. $\endgroup$