Setting up a random effect for repeated measurement AND block and maybe an additional nested factor for a factorial binomial GLMM in R (glmmTMB)

It's about a logistic GLMM to account for repeated measurements, blocks (think about 'spatial' independent observations) and a nested factor. How should my random term look like??? Complex things need to be explained a bit longer, sorry...

Test design

The test design is a RCBD with 5x2x2 factors (so, 20 treatments) with 6 replicates for each combination=120 samples and every sample got it's own sampleID. Within every sample, a male and a female were placed, so this is my additonally nested factor sex. Overall, it's a balanced design.

7 repeated measurements were performed at 2h, 22h, 24h, 26h, 46h, 48h and 50h after teststart ( tf as factor 1:7 ).

This was repeated twice, reflected in blockID (a & b) (actually, you can think of it as they are spatially distributed plots. Anyway, block a and b are independent of each other)

Ending up in 120 samples * 2 nested sexes * 7 tf * 2 blocks= 3360 observations.

The independent variable is an integer counts (succ or fail; so 1/0 and 0/1 are the only possible observations respectively).

Question, which should be answered by the study: My interest is to identify the best performing fac1

I am not interested in the development over time. So, i thought, i should only account for it in the random term, as I learned once, that things someone is not interested in, should be not in the fixed, but in the random term. However, an effect of time is present by nature in any case meaning the longer it lasts, the higher is the ratio of succ/fail. The aim of the study was to examine which of fac1 performes best while accounting also for fac2 and fac3 with respect to sex.

I built a model like this: glmmTMB(cbind(succ,fail)~fac1*fac2*fac3*sex+(1|block/sampleID/sex), family="binomial", REML=F,...). Where succ and fail are the counts explained above. fac1 has 5 levels (4 + water control), fac2 and fac3 have 2 levels each (yes and no). The random intercept should account for sex nested in sampleID nested inblock. I am interested in the effect of fac1, fac2, fac3 and sex and assume interactions.

Is this model (random term) setup right? Or should I not mix up nested things with 'spatial measurement' (this is how I see my blocks, of course they are not separated by space but separated by time, but independent of each other). Maybe my random term should look like this: +(1|blockID) + (1|sampleID/sex). So I should account for the nested and 'spatial' variability separately...

But how do I get my repeated measurement characteristic along with that?

• Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer.
– Community Bot
Feb 17 at 12:10