# assessing glmmTMB hurdle model fit using DHARMa scaled residual plot

My model

glmmTMB(y~fixed1+fixed2+fixed3+fixed4+(1|random),data=df,ziformula~.,


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

• Have you also plotted the simulated residuals produced by DHARMa against each of your predictor variables to see whether there might be evidence of nonlinearity of predictor effects? Also, you could allow the probability of planting wheat to depend on some or all of your predictors in the ziformula. Currently, you are assuming this probability to be constant. – Isabella Ghement Mar 29 '19 at 15:19

• Agreed. I would suggest a binomial model for didn't plant vs planted (no need to worry about distributional assumptions, they can't be violated for a binary outcome) and a log-transformed LMM for the non-zero cases. You could look at a Box-Cox analysis of the residuals of a LMM (or just MASS::boxcox(lm(...)), i.e. ignore the random effects temporarily) if you want to check for a better transformation. – Ben Bolker May 22 '19 at 15:35