user2085797
user2085797

Reputation: 69

Increasing number of iterations for lme4 version 1.1-7

I am encountering a problem with iterations whilst trying to do a mixed effects binomial regression using the glmer function of the package lme4 version 1/1-7.

When I run the model using the code:

model <- glmer(Clinical.signs ~ cloacal +(1|Chicken_ID), family = binomial, 
               data = viral_load_9)

I get the warning:

Error: pwrssUpdate did not converge in (maxit) iterations

When I follow the advice given here

Using the code:

model <- glmer(Clinical.signs ~ cloacal +(1|Chicken_ID), family = binomial, 
               data = viral_load_9, 
               control=glmerControl(optimizer="bobyqa", 
                                    optCtrl = list(maxfun = 100000)))

I still have the exact same error message.

Any suggestions on what might be wrong with my code will be gratefully received.

-----------------------------------------------------------------

Following the advice from aosmith (Thanks for the sugggestion!) I am including the data and the code so as others might be able to replicate the results I am getting. Note that the code worked fine for variable "oral" and produced "model_1", but when I ran it with the variable "cloacal", I got the error message as noted above.

Chicken_ID  <- c(44,44,45,45,46,46,47,47,48,48,49,49,50,50,51,51,52,52,53,55,55)
oral <- c(-0.4827578,-0.1845839,-1.3772797,-0.7809318,-0.4827578,1.6044598,0.1135901,0.411764,-0.1845839,1.6044598,-0.1845839,1.6044598,-1.6754536,0.709938,-1.0791057,0.709938,0.1135901,1.0081119,0.411764,-1.6754536,-0.1845839)
cloacal <- c(-0.9833258,0.450691,-1.1267275,0.7374944,-1.1267275,1.0242977,-1.5569325,1.0242977,0.3072893,1.0242977,-0.1229157,1.1676994,-1.5569325,0.5940927,0.450691,0.3072893,-1.1267275,0.7374944,0.1638876,-1.5569325,1.1676994)
clinical.signs  <- c("YES","YES","NO","YES","NO","YES","NO","YES","YES","YES","YES","YES","NO","YES","YES","YES","NO","YES","YES","NO","YES")
clinical.signs <- factor(clinical.signs)
viral_load <- data.frame(Chicken_ID, oral, cloacal, clinical.signs)


library(lme4)

model_1 <- glmer(clinical.signs ~ oral +(1|Chicken_ID), 
                       family = binomial, data = viral_load)
summary(model_1)

model_2 <- glmer(clinical.signs ~ cloacal +(1|Chicken_ID), 
                       family = binomial, data = viral_load)
                     

Upvotes: 2

Views: 7565

Answers (1)

r.bot
r.bot

Reputation: 5424

It may not be a problem with your code. See this Q on Cross-Validated. Some things you can do to prevent convergence failures:

  • Rescale continuous variables
  • Try different approximators using glmerControl()
  • Check your data for sparse data. If there aren't sufficient outcomes or observations at certain levels of predictors the model may fail to converge.

Upvotes: 3

Related Questions