How could I get max gradient values after doing random effects models with lme4? By default, it is shown if it is more than 0.002, but I want to make an original function as below, which needs a returned value of max gradient, whether the value is more than 0.002 or not.
- Doing the original model
MM<- lmer(Y ~ 1 + X + (1 |cluster_ID ), data=data)
summary(MM)
- If the above original model have the max gradient more than 0.002, then do the below process.
MM_par <- getME(MM, c("theta", "fixef"))
RS_MM <- update(MM, start=MM_par, control=lmerControl(optCtrl = list(maxeval=1e4)))
summary(RS_MM)