I tried to create mixed-effect logistic regression model using glmer()
function, however the model does not converge. Firstly, I changed categorical variables to from vectors to factors.
schwa_completed_2$Outcome <- as.factor(schwa_completed_2$Outcome)
schwa_completed_2$frequency_grouped <- as.factor(schwa_completed_2$frequency_grouped)
schwa_completed_2$sonority_grouped <- as.factor(schwa_completed_2$sonority_grouped)
schwa_completed_2$participant_gender <- as.factor(schwa_completed_2$participant_gender)
schwa_completed_2$participant_age_group <- as.factor(schwa_completed_2$participant_age_group)
schwa_completed_2$Speaker <- as.factor(schwa_completed_2$Speaker)
Also there is one more continuous variable. Then I created a model
model <- glmer(Outcome ~ frequency_grouped + sonority_grouped + syl_sec_EN +
participant_gender + participant_age_group + 1|Speaker,
data = schwa_completed_2, family = binomial, optimizer = "bobyqa")
Unfortunately, the model does not converge. If I got rid off "Speaker" effect the model works just fine, however, the results probably are skewed.
Warning messages:
1: In commonArgs(par, fn, control, environment()) :
maxfun < 10 * length(par)^2 is not recommended.
2: In optwrap(optimizer, devfun, start, rho$lower, control = control, :
convergence code 1 from bobyqa: bobyqa -- maximum number of function
evaluations exceeded
3: In (function (fn, par, lower = rep.int(-Inf, n), upper = rep.int(Inf, :
failure to converge in 10000 evaluations
4: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.0785481 (tol = 0.001, component 1)
Generalized linear mixed model fit by maximum likelihood (Laplace
Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: Outcome ~ frequency_grouped + sonority_grouped + syl_sec_EN +
participant_gender + participant_age_group + 1 | Speaker
Data: schwa_completed_2
AIC BIC logLik deviance df.resid
1820.8 2066.1 -864.4 1728.8 1486
Scaled residuals:
Min 1Q Median 3Q Max
-2.5957 -0.6255 -0.3987 0.7714 3.4432
Random effects:
Groups Name Variance Std.Dev. Corr
Speaker (Intercept) 2.08476 1.4439
frequency_groupedmoderately_frequent 0.78914 0.8883 -0.15
frequency_groupedvery_frequent 3.07514 1.7536 -0.90 0.35
sonority_groupedsonorants 1.33795 1.1567 0.82 -0.44 -0.91
sonority_groupedstops 1.76849 1.3298 0.02 -0.42 -0.36 0.51
sonority_groupedvowels 2.97690 1.7254 0.23 0.02 -0.32 0.55 0.77
syl_sec_EN 0.03217 0.1794 -0.62 -0.42 0.32 -0.44 0.11 -0.52
participant_genderM 0.41458 0.6439 -0.86 -0.18 0.77 -0.77 -0.24 -0.62 0.82
participant_age_groupY 0.52428 0.7241 0.46 0.80 -0.20 0.06 -0.44 0.08 -0.73 -0.63
Number of obs: 1532, groups: Speaker, 40
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -0.7650 0.1862 -4.108 3.99e-05 ***
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
convergence code: 0
Model failed to converge with max|grad| = 0.0785481 (tol = 0.001, component 1)
failure to converge in 10000 evaluations
Is it because of the too complicated model or my laptop is not powerful enough? I don't know what should I do at this point. Is very anything I can do to fix this?