0
$\begingroup$

I'm working on a dataset of ~2900 fish, where the visually estimated sex was compared to the true sex. In about 10% of the cases (≈260 fish), the estimation was wrong (deviation = TRUE).

I'd like to model the probability of a wrong estimation (i.e., deviation = TRUE/FALSE) depending on: the true sex of the fish (estimation is expected to be more accurate in females), fish length, and season (and potentially other predictors/interactions).

A few fish (~100 individuals) were measured repeatedly, while the majority were only measured once. Therefore, I want to include Fish_ID as a random effect to account for repeated measures.

I'm currently using a binomial GLMM with logit link in glmmTMB as follows:

mod_glmmTMB <- glmmTMB(
  Deviation ~ 
    True_Sex           # H1: deviation depends on true sex
  + Season_cat         # H2: deviation depends on season
  + Length             # H3: deviation depends on fish length
  + Length * True_Sex  # H1b: interaction effect
  + Length * Season_cat # H4: seasonal differences in length effect
  + (1 | Fish_ID),
  data   = final_df,
  family = binomial(link = "logit")
)

However, including the random effect (1 | Fish_ID) causes the fit leading to underdispersion and the plot of the dispersion of residuals is not what would expect (checked with DHARMa). This is a similar residual patterns like generated from including an observation level random effect as tested in this specific model (1|rowID).

Here the dispersion of the residuals with the random effect included: Residuals with random effects and the QQ-plot: QQ-Plot with random effects included And this is the plot without the random effect included: Residuals without random effects

So, I am quite happy with the model fit without the random effects where also the parameter estimates make sense to me. However, including the random effect somehow distorts everything and I am not sure what are the steps to diagnose these issues and whether I should abstain from including the random effect, despite having repeated measures in some of my cases?

$\endgroup$
2
  • $\begingroup$ I wonder if a fish being measured repeatedly influences the deviation. Maybe that should be a fixed effect? I think I would look more closely at this subset of data. Is deviation consistent for each fish that has been visually inspected repeatedly? If more than one person has done the visual inspections, you propbably should include the person ID in the model. $\endgroup$ Commented Nov 10, 2025 at 8:49
  • $\begingroup$ Possibly, you need random slopes. However,you might run into issues with the model fitting then. So maybe create separate models for fish with/without repeated measures. $\endgroup$ Commented Nov 10, 2025 at 9:07

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.