I have 16 birds (191978,191984, 191977, 191980, 191986, 201446, 191983, 201447, 211598, 211590, 211595, 191981, 211591, 201441, 201445, 211592). There are 6 males and 10 females. The dataset is called Gbirds_sex
. I have the number of times they revisit their release site (visitIdx
). I also have (timeInside
) column to show the residence time within the release site. I want to do statistical analysis in R to see if sex affects number of revisits (visitIdx
) and residence time (timeInside
). I am confused as to which test works best and the R code for it. LLM, GLM. Should I use a random intercept?
I have tried these:
#1
#visitIdx is a count variable so
# Fit a GLMM with Poisson distribution
library(lme4)
model_glmm <- glmer(visitIdx ~ sex + (1 | id), family =
poisson(), data = Gbirds_sex)
summary(model_glmm)
#2
#residenceTime is continuous - use the Gaussian family.
# Fit the GLMM with Gaussian response distribution and random
# intercept for each individual
model_timeInside_Gaussian <- lm(timeInside ~ sex, data =
Gbirds_sex)
summary(model_timeInside_Gaussian)
However, dispersion was high (2.8)
Should I now use:
library(glmmTMB)
model_glmm_nb <- glmmTMB(visitIdx ~ sex + (1 | id),
family = nbinom2(), data = Gbirds_sex)
summary(model_glmm_nb)
In relation to timeInside
:
Firstly, I ran a GLM:
Fit GLM for 'timeInside' with 'sex' as a predictor using Gaussian family
glm_timeInside <- glm(timeInside ~ sex, data = Gbirds_sex)
summary(glm_timeInside)
Secondly, I checked for overdispersion:
residual_deviance <- deviance(glm_timeInside)
df_residual <- df.residual(glm_timeInside)
Compute overdispersion statistic
overdispersion_statistic <- residual_deviance / df_residual
print(overdispersion_statistic)
Thirdly, as dispersion was high(7), I ran a GLMM with timeInside as the response variable, sex as the fixed effect, and id as a random effect
glmm_timeInside <- lmer(timeInside ~ sex + (1|id), data = Gbirds_sex)
summary(glmm_timeInside)
This didn't fit
boundary (singular) fit: see help('isSingular')
Is the next step a Quasi-Gaussian GLM? Is this okay that it doesn't give an AIC value ("NA")?