# Why do I get the error message "Error: grouping factors must have > 1 sampled level" when I do a glmer?

My model is:

model1 <- glmer(Avg_egg_mass ~ Treatment + Alt_cat + Treatment:Alt_cat + (1|Nest) + (1|Site)+ (1|Year), na.action=na.omit, family = poisson (link=log), data = dframe1)


where I am relating average egg mass (continous variable) to a four group treatment (set to factor) and three categories of altitude (also set to factor).

It doesn't seem to work and I get this error message Error: grouping factors must have > 1 sampled level.

• If your response is continuous, a Poisson model is mis-specified.
– Sycorax
Sep 23, 2014 at 16:25
• @user777 You would be interested, then, in reading the post at blog.stata.com/tag/poisson-regression explaining how and why such a model can be useful.
– whuber
Sep 23, 2014 at 16:43
• @whuber That post is very interesting, and illustrates a use of Poisson regression I was not aware of. But I can't wrap my mind around something simple: if $P$ is a Poisson PMF, then $P(2.5)=0$. So am I correct that the procedure uses an analogue to the Poisson distribution with support over $\mathbb{R}^+$?
– Sycorax
Sep 23, 2014 at 17:07
• @user777 Good point. The fitting is done using maximum likelihood. The contribution to the "likelihood" of the parameter $\lambda$ due to any nonnegative integral value $x$ can be rewritten $\exp(-\lambda)\lambda^x/x!=\exp(x\log(\lambda)-\lambda)/\Gamma(x+1),$ which actually is defined for all real (indeed, complex) values of $x$. I believe that is what is used in this generalized application.
– whuber
Sep 23, 2014 at 17:22