2

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)
                     
Community
  • 1
  • 1
user2085797
  • 69
  • 1
  • 6
  • It'd be easier to help with a reproducible example, but if the model is reasonable and changing optimizers doesn't help (I often start with `nloptwrap` but you have many options), you could try altering the pwrss tolerance in `glmerControl` ([for an example see this](https://stat.ethz.ch/pipermail/r-sig-mixed-models/2014q1/021836.html)). If that helps things converge you might be able to see evidence of, e.g., complete/quasi-complete separation problems. – aosmith May 20 '15 at 17:07
  • Thanks for suggestion regarding the "pwrss" option. I re-ran the model as follows: `model <- glmer(Clinical.signs ~ cloacal +(1|Chicken_ID), family = binomial, data = viral_load_9, control=glmerControl(optimizer="bobyqa", tolPwrss=1e-3,optCtrl = list(maxfun = 100000)))` - but the error message stayed stubbonly the same – user2085797 May 21 '15 at 19:52
  • Hmm, you might consider adding your dataset or another example that reproduces the problem. – aosmith May 21 '15 at 22:05
  • You have complete separation. Take a look at a summary of `cloacal` for each group (`by(viral_load[3], viral_load$clinical.signs, summary)`) - there is no overlap in values between the two groups. You can also quickly see the problem If you ignore the random effect for a moment and fit the model with `glm`. – aosmith May 22 '15 at 13:12
  • Yes you are correct about the complete separation problem. Well done! This is not something I had come across before, but i found a very good explanation of it at [link](http://www.ats.ucla.edu/stat/mult_pkg/faq/general/complete_separation_logit_models.htm). I will need to do some more research to apply some of the suggested solutions for modelling my difficult dataset, but I think this now closes my original question. Once again, thanks for your assistance. – user2085797 May 23 '15 at 23:04

1 Answers1

3

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.
Community
  • 1
  • 1
r.bot
  • 5,309
  • 1
  • 34
  • 45
  • Thanks ... and a very valid suggestion. In fact, when i first had the problem with convergence, I suspected it was a data issue thus I undertook standardising of the covariates, with centering around "0". But after re-running the model - i had the same error message about a convergence problem. Accordingly this made me think it was my code ... or else a problem with the lme4 library..... – user2085797 May 20 '15 at 11:23