# Mixed effects modelling; what to do when model is over-specified?

I'm trying to use mixed-effects modelling to analyse some data. There are a number of variables that I need to specify within the model, two of which are between-participants (x1 and x2) and two of which are repeated-measures (z1 and z2). I'm interested in individual differences both generally and in relation to the repeated-measure variables.

From what I understand, according to Barr's (2012) 'Keep it maximal' paper, the lmer syntax should be:

y ~ x1*x2*z1*z2+ (1+(z1*z2)|ID)


When I try to run this in R, it fails, I think the error message is telling me that I've over-specified the model:

Error in checkZdims(reTrms$Ztlist, n = n, control, allow.n = FALSE) : number of observations (=289) <= number of random effects (=292) for term ((z1 * z2) | ID); the random-effects parameters and the residual variance (or scale parameter) are probably unidentifiable  Is there a way to maximally specify my model, or do I need to restrict my random effects term? If so, what would the new term be? • Do you have multiple observations for each ID at each level of z1, z2,and z1:z2? See output of xtabs(~ID+z1+z2). It is unusual for this to be the case unless there is crossing of random effects, in which case your model is overspecified, even according to Barr et al. Sep 6, 2014 at 9:24 ## 1 Answer The Keep it maximal proposal is not to be taken as a dogma. Be more pragmatic, and try to determine what level of model complexity your data will support (or at least a maximal level that will be supported). Computationally speaking: The IWRLS estimation procedure used might not converge to the optimal parameter values; as a result your inference will be wrong. In addition, a large number of parameters in a model may results in a very flat (conceptually speaking) log-likelihood surface and as a consequence the optimization problem you were previously solving "easily" just become extremely hairy. The reasonable thing to do is to reduce the number of groups you are estimating. Right now you have an over-parametrized LME models; as you assume a model$y\sim N(X\beta,ZDZ^T+\sigma^2I)$what is written essentially has more variance parameters than data-points. Check for starters something like: y ~ x1*x2*z1*z2+ (1+z1|ID) + (1+z2|ID)) if you feel you should have correlated random slopes and intercepts in your model. This is already quite explicit for a covariance structure anyway. You can modify the model later if it does not fit your modeling assumptions. And to get back to you original final question: No, there is no way to automatically specify the maximal random effects structure of your model; unfortunately there is no$silverbullet\$ for that statistical question.

• Can you recommend any reading regarding when it is necessary to have correlated random slopes and intercepts? I can understand in the case of item wise variability, but since I'm from a Visual Neuroscience background, I find relevant literature difficult to come by. Aug 12, 2014 at 5:33
• I am sorry but I do not recall any specific books. The two books I have mostly studied are Mixed-Effects Models in S and S-PLUS by Pinherio and Bate and Generalized Linear Mixed Models: Modern Concepts, Methods and Applications by Stroup. Estimation Procedures for Hierarchical Linear Models by Hariharan & Rogers was also a good read on the matter. Aug 12, 2014 at 20:41