I am trying to:
- Build a model to investigate the effect of
landcover
(a continuous variable) onpresence
of a species. - Test if and how this effect changes with
season
(a categorical variable, spring and fall).
However, no animal in my data set has observations in both seasons.
I am using R package glmmTMB to estimate a binomial GLMM with random intercept and random slope for animal ID
, but I don't know how to represent the effects of landcover
(the variable of interest) and season
in the model formula.
I have tried these two variations:
1)
glmmTMB(presence ~ landcover:season + (1 | ID) + (0 + landcover:season | ID),
family = binomial(), data = dat.rsf, doFit = FALSE, weights = weight)
This one is more intuitive to me, but does not converge. Is that just an indication that I cannot estimate this model with my data? Or is this model not the best way to get at the relationships that I am trying to test?
2)
glmmTMB(presence ~ landcover:season + (1 | ID) + (0 + landcover | ID),
family = binomial(), data = dat.rsf, doFit = FALSE, weights = weight)
This converges, but is not as intuitive. Does it make sense to not include the interaction in the random slope when I include it as a fixed effect? Or does that violate the principle of a random slope?