Hi everyone: I'm hoping for help analyzing nested data in R. I measured the mass of chicks at 3 time points; chicks were in one of two treatments (P and W) and in one of two environmental conditions (Wet or Dry). I have measurements from multiple chicks per (literal) nest.
Here's what the data look like:
chick nest visit treatment condition mass
1 a 1 1 P dry 4.5
2 a 1 2 P dry 17.2
3 a 1 3 P dry 32.4
4 b 1 1 P dry 4.2
5 b 1 2 P dry 18.0
6 b 1 3 P dry 30.2
7 c 2 1 P dry 5.2
8 c 2 2 P dry 18.3
9 c 2 3 P dry 31.0
And here's what the data look like plotted
I'm trying to use a linear mixed effects model in lme4 to test the hypothesis that the treatments differ in the dry conditions but not otherwise but I am not sure how to code the random effects/ leverage repeated measures of each individual chick. What do you think of these approaches? Option 1)
lmer(mass~ treatment * condition + (1|visit/nest/chick)
Option 2)
lmer (mass~treatment * condition + visit +(1|nest/chick)
Thanks for any help.