I am confused about how random effects are structured in my model. I've read the discussion about it Crossed vs nested random effects: how do they differ and how are they specified correctly in lme4?. But I'm still having doubts.
I measured the response in plants as Duration [in seconds] at two Ages [young and old] using the same plants. So, I think it's a repeated measures design with crossed random effects, because the same individuals were measured two times, first at T1, then at T2. I assumed it is not nested, because subjects are not independently measured at Age.
My data:
plantID | Age | Duration | Nleaves.plant |
---|---|---|---|
1 | Young | 1.33 | 18 |
1 | Old | 2.64 | 75 |
2 | Young | 4.68 | 14 |
2 | Old | 4.99 | 56 |
3 | Young | 3.34 | 26 |
3 | Old | 3.75 | 94 |
I think that I have a crossed design, so a model like this would be appropriate:
m <- glmmTMB(Duration~ Age+ Nleaves.plant +(1|plantID) + (1|Age), data=df, family = Gamma("log"))
But I also was wondering if this model is correct as well:
m2 <- glmmTMB(Duration~ Age+ Nleaves.plant + (Age|plantID), data=df, family = Gamma("log"))
My questions are:
- Which model is correctly specified?
Sorry about this question, I know that it has been adressed many times in this forum, but I am still confused on this topic. Thank you for your time.