Skip to content

glmmTMB: Including variable in as fixed effect and in dispersion model

2 messages · Andre Syvertsen, Ben Bolker

#
Hi guys,

Is it possible/meaningful to include a variable both as a fixed effect and in the dispersion model? For example, I have run the following model:

m4DaysPlayed <- glmmTMB(daysPlayed ~ 1 + time + ageCategory * gender + (time | id), disp = ~time, dfLong, family = truncated_nbinom2)

Rationale: I want to study the effect of time on the outcome variable, but I have also found evidence for heteorskedasticity when simulating through DHARMa. I suspect that the time variable influences this, the sample size decreases/variation increases as time goes on.

Kind regards,
Andr?
#
I don't see why not, although to some extent the negative binomial 
error structure should account for the phenomenon you're seeing: since 
the variance of the nbinom(2) is var = mu*(1+mu/k), the coefficient of 
variation is sqrt(var/mu^2) = sqrt(1/mu + k).  I'm not sure what you 
mean by "sample size decreasing", but for a large mean (mu), the CV 
should be approximately constant (~ sqrt(k)), while for small mean the 
CV should be increasing with decreasing mu (~ sqrt(1/mu)).

   It might be worth trying truncated_nbinom1 as well?
On 6/25/21 6:32 AM, Andre Syvertsen wrote: