# Zero inflation with no zeros in data?

I am investigating feeding rates in great apes. Because I am using count data, I built a generalized linear model with a Poisson link function. So I put the number of items in a bundle as a response and as an offset term the needed time per bundle. We want to see if there is any class difference between the rates. Here the model:

Frates <- glmer(NumberPerBundle ~
Class + FoodAvailability + offset(log_TimePerBundle) +
(1+ FoodAvailability|FoodItem) + (1|ID),
family = poisson,
data = Frates)


Now I checked for zero inflation in my model with the DHARMa package:

testZeroInflation(Frates)
# DHARMa zero-inflation test via comparison to expected zeros with
# simulation under H0 = fitted model

data:  simulationOutput
ratioObsSim = 0, p-value < 2.2e-16
alternative hypothesis: two.sided


As I interpret this, the test says there is zero inflation in my model, but there are no zeros at all in my data set. The minimum value of number of items per bundle and the time per bundle is 1. Class as well as food item are categorical and food availability has as well no zeros.

That is why I am a bit confused. Hope somebody has an idea.

• From the testZeroInflation help page: "The plot shows the expected distribution of zeros against the observed values, the ratioObsSim shows observed vs. simulated zeros. A value < 1 means that the observed data has less zeros than expected, a value > 1 means that it has more zeros than expected (aka zero-inflation)." You have ratioObsSim = 0 so there are fewer zeroes in your data than expected from the simulation. See the answer from @AdamO (+1) for helpful details about what's going on in terms of dispersion versus what's expected from a Poisson distirbution.
– EdM
Commented Mar 3, 2022 at 20:36
• @EdM can you send me the link of that help page? Thank you! Commented Mar 8, 2022 at 9:22
• It's in the main reference manual, on page 59 of the current version.
– EdM
Commented Mar 8, 2022 at 14:27

What you have shown in the histogram is the untransformed response. When you are dealing with generalized linear models, the untransformed response does not follow the underlying distribution unless the covariates have no contribution to the mean response. What you are looking at in the histogram is a complicated mixture distribution. If the predicted mean response is positive, you may have "zero inflation" even when there are no zeros in the sample. Zero-inflation is a way of handling dispersion. At least that's what the DHARMa package believes.

You could begin by looking at the Pearson residuals. If you take $$r_i = (Y_i - \hat{Y_i}) / \sqrt{\hat{Y_i}}$$ then you would expect that the scatterplot of $$r_i$$ versus $$\hat{Y_i}$$ would not have any funnel shape. However, a funnel-shaped heteroscedasticity would indicate that there is dispersion.

A better place to start is to consider the distribution of $$Y_i / \hat{Y}_i$$, the so-called observation expectation ratio. If the $$Y$$ are indeed conditionally Poisson distributed, the mean O/E ratio has a limiting normal distribution, with mean 1 and with variance $$\sum_{i=1}^n \sqrt{1/\hat{Y}_i}$$. However, if the $$Y_i$$ is over (or under) dispersed because of zero-inflation, the O/E ratio will be significantly different from 1.

That is precisely what the DHARMa package tests with the "testZeroInflation" command.

All this is a strange way to say that nobody really agrees what "zero-inflation" means in a regression modeling context. You couldn't be faulted for assuming that there should be actual zeros in the sampled response. Plus the DHARMa package is not really actually testing for zero-inflation, but rather it's testing for overdispersion - a topic I've posted on in a few places. As long as you're clear about your methods others will follow your approach. For instance, one would question why you've run such an analysis if you believe zero-inflated Poisson regression means there are actual zeroes in the sample.

How important is the assumption of the poisson distribution?

How to deal with overdispersion in Poisson regression: quasi-likelihood, negative binomial GLM, or subject-level random effect?