I am looking for advice on the proper model notation to test for differences between sex in my data. My goal is to determine whether or not I need to split my data into M and F, or if I can keep my data combined (I hope that I will be able to keep it combined due to sample size).
I am using the glmmTMB package in R for resource selection function analysis and my plan is to run 1 model with random intercepts and slopes, without sex, and then compare this model to essentially the same model but contains sex as an interaction term. I will compare AIC to determine the most supported model (i.e. if the model with sex is supported, then I will separate my data into M and F and analyze separately. If the model without sex is supported, then I will keep it combined).
I am following the code provide in the supplementary materials by Muff et al. 2019 (model M4): https://conservancy.umn.edu/bitstream/handle/11299/204737/Goats_RSF.html?sequence=21&isAllowed=y
For example:
My model without sex looks like this:
glmmTMB(Used_and_Available_Locations ~ Urbanization + (1|AnimalID) + (0 + Urbanization|AnimalID), family = binomial(),...)
My model with sex is where I am confused...How do I account for sex as a random effect when there is an interaction? Should I not account for sex as a random effect?
glmmTMB(Used_and_Available_Locations ~ Sex + Sex*Urbanization + Urbanization + (1|AnimalID) + (0 + Urbanization|AnimalID), family = binomial(),...)