0

Help!

I have a nested mixed effects model I am trying to run with site and plot ("plotID") as my random effects. Multiple plots fall within sites (9 plots per site) so site is assigned as a shared number between all 9 plots within that site, i.e. all 9 are "1" within site 1, next 9 are "2" within site 2. As subplots are nested within plots (2 subplots per plot) plot is labelled as pairs, i.e., 2 sub-plots are both "1.2, 1.2", next 2 plots are "1.3,1.3"= "plotID". I have 18 sub-plots per plot for reference, 9 plots per site, and 9 sites total. My total observations are 162.

When I try to run the glmer using factors only I have no issues but when I add the continuous responses "soil" and "gap" as fixed effects I get convergence and scaling issues non-stop!

For reference the variables do not have a very big range (within >1 to <100) so I am not sure why scale should be an issue (I did try standardizing in arm nevertheless). My response is proportion data which I modeled as the "binomial" family and used weight "total" which is the total # (n=25) possible. "propgerm" is the proportion of seeds that germinated out of 25 total.

Here is some of my initial errors/ solutions:

Model with factors only ("moist" and "light" are observed values with 3 levels= high, med, low)


m1 <- glmer(propgerm ~ cage+suit+moist+light+cage*suit+ cage*moist+ 
+cage*light+suit*moist+suit*light+(1|site/plotID), 
family=binomial, weights= total,data=data)

***Warning message: In checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, : Model failed to converge with max|grad| = 0.0825455 (tol = 0.002, component 1)

I was able to fix this by changing the optimizer:

library(optimx)

m1 <- glmer(propgerm ~ cage+suit+moist+light+cage*suit+ cage*moist+ 
+cage*light+suit*moist+suit*light+(1|site/plotID), 
family=binomial, weights= total,data=data, 
control = glmerControl(optimizer ='optimx', optCtrl=list(method='nlminb')))

drop1(m1,test= "Chisq")

**results:

Model: propgerm ~ cage + suit + moist + light + cage * suit + cage * moist + +cage * light + suit * moist + suit * light + (1 | site/plotID) npar AIC LRT Pr(Chi) 675.83 cage:suit 2 673.00 1.1654 0.558377 cage:moist 2 677.61 5.7817 0.055528 . cage:light 2 681.31 9.4815 0.008732 ** suit:moist 4 673.35 5.5224 0.237771 suit:light 4 675.08 7.2493 0.123286

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1**

Okay that seemed to fix the issue :-)

NOW Try model with continuous vectors soil (%) and gap (light canopy gap index) instead of moist/light (factors) - I can confirm they are numeric!


m2 <- glmer(propgerm ~ cage+suit+soil+gap+cage*suit+ cage*soil+cage*gap+suit*soil+suit*gap+(1|site/plotID), 
family=binomial, weights= total,data=data, glmerControl(optimizer ='optimx', optCtrl=list(method='nlminb')))

**Warning: Model is nearly unidentifiable: large eigenvalue ratio

  • Rescale variables?

Okay so let me try standardizing these numeric "soil" and "gap" values with arm package...

library(arm)

standardize(m2, unchanged = NULL, 
    standardize.y = FALSE, binary.inputs = "center")

Warning: convergence code 1 from optimx: noneWarning: Model failed to converge with max|grad| = 0.0624817 (tol = 0.002, component 1)Warning: Model is nearly unidentifiable: very large eigenvalue

  • Rescale variables?Single term deletions

Nope.... when I re-run the model I still get the same issue! Solutions?? I did also try changing the number of iterations with no success...

  • You could plot the results based on various optimizers. If the results are consistent across optimizers, they would be more trustworthy. A function and a code-through is available at: https://pablobernabeu.github.io/2021/a-new-function-to-plot-convergence-diagnostics-from-lme4-allfit/ – Pablo Bernabeu Jun 24 '23 at 11:07

0 Answers0