1
$\begingroup$

I'm trying to run a model which has 3 random effects. Its data on an animal species and the random effects are 'group', 'mother' and 'individual'. Individual should be nested within mother, and then both are crossed within group separately, because both individuals and their mother can move to different groups independent from one another.

  1. Is it accurate to specify this as:

(1|group:mother/individual) - does this account for the fact that an individual could move to another group, without its mother, or would they always have to be nested together?

N.B. I'm using glmmTMB and also wasn't sure if it recognise the crossed/nested nature of the random effects without specifying them.

Following on from this using a maximal random slopes framework, for 5 different fixed effects, I would like to specify different random slopes for each of the random effects.

  1. Is it possible to specify different random slopes for the different random effects when they are already denoted as crossed or nested?

  2. If I cannot pick different nest/crossed random effects should the different random slopes take priority or the nesting/crossing of the random effects?

Many thanks!

$\endgroup$

1 Answer 1

0
$\begingroup$

Question 1 is a quick no. Individual nested in mother and both crossed with group should be something like (1|mother/individual) + (1|group). See here for context: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#model-definition

For question 2, the crossed random effects definitely don't care for the nested on we can use the alternative notation (1|mother/individual) = (1|mother)+(1|mother:individual), now replace the 1s with what you want. I checked real quick and it semms to work:

library(glmmTMB)
dat <- Salamanders
m1 <- glmmTMB(count ~ mined + (1|sample) + (cover|sample:site),
               zi=~mined,
               family=poisson, data=Salamanders)
summary(m1)
m2 <- glmmTMB(count ~ mined + (cover|sample) + (1|sample:site),
              zi=~mined,
              family=poisson, data=Salamanders)
summary(m2)

Question 3 shouldn't be an issue, however with many random effects/slopes, many of them correlated you will likely get a singular fit, i.e. the variation of the random effects is 0 in some "direction". Again I point to Ben Bolkes FAQ: https://bbolker.github.io/mixedmodels-misc/glmmFAQ.html#singular-models-random-effect-variances-estimated-as-zero-or-correlations-estimated-as---1

$\endgroup$
1
  • $\begingroup$ Thanks very much Lukas this was really helpful. $\endgroup$
    – JJRich91
    Commented Sep 22, 2023 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.