I have a question on how to specify a GLMM. I made an experiment with two treatments (control and treated) to test the effect of a water contaminant on reproductive cells of tadpoles. I have data on proportion of oocytes in a histological photo. I took several photos for each animal. My main interest is to test the effect of the treatment on the response variable. However, animals happen to be in different developmental stages. I have 5 stages in total. I tried to model these data using a glm including treatment and stage as fixed factor and the photos nested within an animal as random factors.

So first, I found out using:


that the response variable is better modelled by a negative binomial, so I went on and used the lme4::glm.nb like this:

glmer.nb(Oocytes_Total~Treatment+as.factor(Stage)+(1|Animal:Photo), data=datos)

My question is: should I include the stage as fixed factor or a random factor to which Animal and Photo would be nested within? I'm only interested in the effect of the treatment, I only included the stage to control for this effect. The point is, a given animal will always have the same stage. Is my model above correct?


1 Answer 1


You don't really have enough stages to model it as random effect, and from what you said it doesn't seem like the 5 stages are a random sample from a wider population of stages (which is the usual way to think of random effects).

So I think you should include Stage as a fixed effect which cements it's role as a possible confounder.

Although you haven't asked about the other random effect, (1|Animal:Photo), I think you should specify this as (1|Animal/Photo) to reflect that there are several photos per animal, otherwise, with the way you wrote it, you only have random intercepts for the interaction.

  • 1
    $\begingroup$ That's right. Thank you @RobertLong! I had tried that random effect (1|Animal/Photo) as well but wasn't sure which one to choose. Thank you for clarifying that too. $\endgroup$ Commented Jul 23, 2016 at 18:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.