I have several animal pairs pair
. For each, I repeatedly measured daily proportions of time they spent in contact time.con
(30-60 measurements for each group, 1 measurement per date
). I want to compare how much time different pairs spent in contact using lmer
and controlling for repeated measures. The pairs are permanent, so essentially pair = individual. Here is a simplified example:
pair date time.con
[1,] "1" "01.06.17" "0.12"
[2,] "1" "02.06.17" "0"
[3,] "1" "03.06.17" "0.11"
[4,] "2" "04.06.17" "0.34"
[5,] "2" "05.06.17" "0.02"
[6,] "2" "06.06.17" "0.07"
[7,] "3" "01.06.17" "0.14"
[8,] "3" "02.06.17" "0.26"
[9,] "3" "03.06.17" "0.1"
So, the fixed effect would be pair
. The question is, how do I control for repeated measures? If I use pair
as both fixed and random effect, the model, obviously, fails to converge:
lmer(time.con ~ pair + (1|pair))
I guess that's where I'm meant to use date
somehow (as nested in pair
?), but I cannot get the syntax right:
lmer(time.con ~ pair + (1+pair|date))
(doesn't work)
I'm probably missing something simple, as I'm new both to R and lmm.
time.con
you may want to consider a two-part mixed model, for example, check the GLMMadaptive package: drizopoulos.github.io/GLMMadaptive/articles/… $\endgroup$how follow_up_time
would be meaningful... Thanks very much for the link! $\endgroup$