I'm trying to handle some data and get some insights from it.
The data includes a binary outcome variable, so I am using glmer.
The relationship is whether age groups are more likely to engage in the outcome variable. The issue is that many participants have multiple observations, over a time span of about two years.
I've created a model that includes participant ID as a random effect, which is good.
glmer(Modality ~ Age_Quartile + (1|pt_number), family = "binomial", data = tel)
The issue I'm running into is including time. I'm not sure if I want to include it at all, but it seems that the relationship seems to switch at a point in time (based on some EDA), so I feel it should be included. However, I'm not sure if it should be put in as a separate random effect, or if it should be nested in the participant ID, and if so, which direction the nesting should be.
Options:
Separate effect:
glmer(Modality ~ Age_Quartile + (1|pt_number) + (1|monthnum), family = "binomial", data = tel)
Time nested within ID:
glmer(Modality ~ Age_Quartile + (1|pt_number/monthnum), family = "binomial", data = tel)
ID nested within time:
glmer(Modality ~ Age_Quartile + (1|monthnum/pt_number), family = "binomial", data = tel)
I appreciate any help, and I apologize if my question is too vague.
Thank you!