I'll try to make this as brief as possible. I am working with binomial attendance data (0 = absent, 1 = present) for seabirds at a breeding colony. There are ~300 birds that contribute ~60 days of data for each breeding season, and there are 4 breeding seasons in total. Most birds are present more than once throughout these 4 years, and will therefore contribute seasons of attendance data. For example, a given bird might breed 3 out of 4 years, and will therefore contribute 3 sets of ~60 days of 0s and 1s.

We are looking at what factors influence attendance throughout the breeding season. So, in addition to the fixed effects in my model, we have two random effects: "Year", to account for variation in attendance due to the breeding season; and "ID", to account for variation between individual birds (because we have repeated measurements of individuals).

However, we have reason to suspect that attendance patterns will vary not just between individual birds, but also that individuals themselves will vary in their attendance patterns from year to year. We are therefore trying to incorporate random effects that will account for three sources of variation in the data:

  1. Variation between years ("Year")

  2. Variation between individuals ("ID")

  3. Variation between years for a given individual (Not included in the model)

I am struggling to understand whether or not we are currently taking care of point 3 with the two random effects. In the current model, this is the code:

Attendance ~ Fixed effects + (1|Year) + (1|ID)

I am wondering if I need to nest one random effect within another, or if I need another random effect entirely? One thought I had was keeping "Year" the same, and changing "ID" to include both the individual and the year (so it would look like "Bird153Year1", "Bird153Year2", etc., instead of just "Bird153", to account for the yearly variation for each individual bird).

Please let me know if I'm overthinking this and how I might go about structuring my model set. Thanks!

edit: Here's another question that's basically the same as mine:

Interactions between random effects


1 Answer 1


It sounds like you are looking to model the interaction between year and individual, which might look something like this:

Attendance ~ Fixed effects + (1|Year) + (1|ID) + (1|Year:ID)

Whether or not this is a good idea depends on how much you expect this year-individual term to actually matter and how big & noiseless your dataset is. Just like the many interactions you could check for between all your fixed effects and each other and year and individual, the contribution of the year-individual term probably isn't truly 0. However, if it's a small effect and your dataset is relatively tiny and/or noisy, including it might just lead to overfitting.

  • $\begingroup$ I wasn't aware you could use interaction terms for random effects! That does make sense though, and it's exactly what I was looking for. And I've already dealt with singularity issues before so I'll just not include it if the model fails to converge. Thanks! $\endgroup$ Jan 8 at 23:57

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.