rmodelmixedglmm

Random effects nested


I'm pretty new to the world of mixed models, and I'm looking for validation from people who are more knowledgeable than I am.

I have a randomized complete block design with different 8 treatments repeated 4 times. I've been monitoring aphid populations on plants in the field (count) at different dates. I want to know if one of the treatments was more effective than another (in other words, in which treatment did I get fewer aphids?). The trial was carried out 7 times (2 sites in 2022, 3 sites in 2023 and 2 sites in 2024).

To sum up, I have the following variables :

Aphids : Count 
Plant : 10 Plant per plot (new at each day of assessment)
Plot : 32 per site 
Block : 4 levels per site
Treatment : 8 levels per site 
Site : 7 levels (field where is located the trial)
Date : the day of the assessment
Year : 3 levels

I guess I have to put in random effect:

These random effects are nested, so I tried to respond at my question with the following model :

modele.abond <- glmmTMB(Aphid ~ Treatment + (1|Year) + (1|Year/Site) + (1|Year/Site/Block) + 
                          (1|Year:Site:Block), 
                        data = DF, 
                        family = nbinom2)

Given the hierarchical structure, does this model seem relevant to you?

Many thanks in advance !


Solution

  • I would suggest something like

    Aphid ~ Treatment*Year +  cs(1+Treatment|Year:(Site/Block))
    
    ntreat <- 8
    mapvec <- list(theta = factor(rep(1:4, c(ntreat, 1, ntreat, 1))))
    

    Since the parameters for each random effect term (Y:S and Y:S:B) are specified with the ntreat log-SDs followed by one correlation parameter, this says that the ntreat log-SDs for each term should all be estimated as the same value.