I'm trying to find variance in infectivity trait of animals in different herds. Each herds contains a fixed number of offspring from 5 different sires.
Example of data:
Herd | S | C | DeltaT | I | sire1 | I1 | sire2 | I2 | sire3 | I3 | sire4 | I4 | sire5 | I5 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 20 | 0 | 14 | 1 | 13 | 0 | 26 | 0 | 46 | 0 | 71 | 0 | 91 | 1 |
1 | 1 | 0 | 14 | 5 | 13 | 1 | 26 | 0 | 46 | 2 | 71 | 1 | 91 | 1 |
18 | 4 | 0 | 14 | 13 | 2 | 5 | 52 | 4 | 84 | 2 | 87 | 2 | 98 | 0 |
19 | 11 | 3 | 14 | 27 | 2 | 6 | 13 | 7 | 18 | 3 | 46 | 5 | 85 | 6 |
Herd is the herdname. S is the number of susceptible animals in the herd, C is the number of cases in the time interval. DeltaT is the time interval length. Sire# is the ID of the sire in the Herd. I# is the number of infected Ofspring of the corresponding Sire#.
This means that a sireID "13" in the first two rows in the column sire1. Refers to the same sire as the "13" in sire2 of the last row. To include these 5 sires into one random effect in a glmer of lme4 is getting me in trouble.
I tried:
glmer(data = GLMM_Data,
cbind(C, S-C) ~ (1 | Herd) + (1| (I1 | sire1) + (I2 | sire2) + (I3 | sire3) + (I4 | sire4) + (I5 | sire5)),
offset = log(GLMM_Data$I/nherds * GLMM_Data$DeltaT),
family = binomial(link="cloglog"))
This gave errors. So any help on combining these 10 columns in a single random factor would be more than welcome. Thanks in advance.
p.s. I know my offset, family and the left side of the formula are working since the analysis of susceptibility is working