My model
glmmTMB(y~fixed1+fixed2+fixed3+fixed4+(1|random),data=df,ziformula~.,
family=list(family="truncated_nbinom1",link="log"))
The response variable (y
) is e.g. kilos of wheat seeds planted per month. This involves two decisions (1) whether or not to plant wheat (2) number of kilos. Thus there are many zeros (some farmers chose not to plant wheat).
The random variable would be farms.
fixed4
is month as there were only 13 months in the study. I have tried it as random but there are insufficient cases.
Each case in the data set is a farm-month. not all farmers participated in the study for all months (but most did).
This form of response variable I think makes a hurdle model likely to be suitable as does the distribution of the variable (see histogram below)
Running the model with lmer
and using DHARMa
to understand fit suggests that there are problems with uniformity (qqplot
) and zero inflation but not with dispersion. Poisson and binomial models also show problems with uniformity.
The hurdle model suggests there is not a problem with uniformity and the QQ plot seems suitable. However there is a problem with under dispersion and also in the residual vs predicted plot (see below right). The residual vs predicted lines do not match - there are red diagonal lines
I would like to know the extent to which this is a problem for the model? Is this just an illustration of the warning that "glmmTMB doesn't implement an option to create unconditional predictions from the model, which means that predicted values (in res ~ pred) plots include the random effects. With strong random effects, this can sometimes create diagonal patterns from bottom left to top right in the res ~ pred plot"
Also is it the case that underdispersion is not at issue in a hurdle model ? see https://github.com/glmmTMB/glmmTMB/issues/313