[R-sig-ME] [R] error message and convergence issues in fitting glmer in package lme4

Douglas Bates bates at stat.wisc.edu
Fri Feb 27 23:17:02 CET 2009

On Fri, Feb 27, 2009 at 1:28 PM, Tanja Srebotnjak
<tanjas at u.washington.edu> wrote:
> Dear Prof. Bates,

> Thank you for your prompt response. And yes, it would be great if you wanted to look at the data.

> Yesterday, I continued working on the data and the model. When I changed the specification of the random effect to (1|fips) instead of (1|as.factor(diab$fips)),  I seem to have got rid of the error message (at least I could fit models that I couldn't previously...):

> Error in validObject(.Object) :   invalid class "mer" object: Slot Zt
> must by dims['q']  by dims['n']*dims['s']

Of course. I should have noticed that.  The problem is that diab$fibs
can be different from fibs if you have missing data in one of the
covariates.  I expect that there are some missing values in the
fastfood variable.  If you create the model matrix for the random
effects (this matrix is sometimes written as Z and the Zt slot is the
transpose of that matrix) based on the original fips variable then it
will not have the same size as the model matrix created from the
variable in the model frame.

More information about the R-sig-mixed-models mailing list