What to do about very unstable mixed-effects models I'm working on some poisson mixed effects models for an interrupted time series analysis, and I'm running into two frequent errors. The first I've posted on Stack Overflow, as it appears to be purely a programming question, but generally speaking, the models are having pretty serious convergence issues.
Consider a model like:
mod <- glmer(Outcome ~ Exposure + Var1 + Var2 + t_before + t_after +(Var1 + Var2 + t_before + t_after|SiteID) + offset(log(PersonDays)),family=poisson, data=data,control=glmerControl(optimizer="bobyqa",optCtrl = list(maxfun = 500000)))
In terms of controlling for confounding, this model doesn't do much - it controls for some trends, two potential confounders, and that's it. Yet there's still some pretty serious convergence issues, and simplifying the model further seems to just be sacrificing validity for the sake of having the model run.
In this kind of case, is there another technique one should be using? An alternate package? Other ideas?
 A: Actually, in addition to the random intercepts, you are adding 4 random effects (assuming that none of the Var1, Var2, t_before, and t_after variables are factors) that are all allowed to be correlated. That's $5$ variance components plus $(5\times4)/2 = 10$ correlations, so $15$ var-cov parameters for the random effects alone. In addition, you have $5$ fixed effects (again, assuming no factors), so we are up to $15 + 5 = 20$ parameters in total. Unless you have a large dataset, it's no surprise that convergence is an issue.
Just to make sure -- all of the variables for which you are adding random effects (i.e., Var1, Var2, t_before, and t_after) should be non-constant within SiteID (otherwise it's not possible/sensible to add random effects for these variables).
You could consider assuming that all of the random effects are independent. That would be:
mod <- glmer(Outcome ~ Exposure + Var1 + Var2 + t_before + t_after + (1|SiteID) + (0+Var1|SiteID + (0+Var2|SiteID) + (0+t_before|SiteID) + (0+t_after|SiteID) + offset(log(PersonDays)), family=poisson, data=data, control=glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 500000)))

Then you are down to $5$ fixed effects plus $5$ variance components, so $10$ parameters in total. Whether it is reasonable to assume independence among the random effects is something you need to consider though.
