# Expected value and model expression for Zero Inflated Negative Binomial

I've been working around Zero Inflated models. The data that I have, however, shows overdispersion so I am using a Zero Infalted Negative Binomial to model counts considering exposure.

The end goal that I am trying to reach is simply to show the expected value of children who consume a specific medication, considering their exposure to treatment.

Here's what I have so far:

• The model, itself, should consist of two components: a zero component (logit): $$P(y=j)=\pi + (1-\pi)f_{Count}(0) if j=0$$ and the actual count component (negative binomial in this case): $$(1-\pi)f_{Count}(j), if j>0$$
• Assuming that $$\pi$$ represents the probability of a 0 occuring.

So the model equation would simply require the replacement of $$f_{Count}$$ with the point mass function of the Negative Binomial. But in that case, the exposure is not accounted for.

For this, GLM seems to be an appropriate alternative. But I am having trouble writing the model and the expected value of it. I've read that in $$Y \sim NegativeBinomial$$, $$E[Y] = (1-\pi)\mu$$ where $$\mu$$ is the mean of the density of $$f_{Count}$$.

So should my link function be $$log((1-\pi)\mu)$$? If so, how do I proceed to, still, obtain the expected value of my data, given the fact that the model that I defined is defined by branches?

(I hope I got my point across. I am sorry if the terms are statistically incorrect, I tried my best.)

• The way you framed the zero-inflated model isn't quite correct. A negative binomial model can give zero counts on its own. The zero-inflation model posits a separate process that leads to more 0 counts than you would expect just from negative binomial. In the example here, some of those who went fishing might have caught 0 fish (negative binomial), but some people didn't even try to fish and thus added additional 0 values (zero-inflated) to the observations.
– EdM
Jun 29, 2022 at 17:08

The log-likelihood for a zero-inflated negative-binomial model can be written as:

$$\mathcal{L} = \left\{ \begin{array}{ll} \sum_{i=1}^{n} \left[ ln(p_{i}) + (1 – p_i)\left(\frac{1}{1 + \alpha\mu_{i}}\right)^{\frac{1}{\alpha}} \right] &\mbox{if } y_{i} = 0 \\ \sum_{i=1}^{n} \left[ ln(p_{i}) + ln\Gamma\left(\frac{1}{\alpha} + y_i\right) – ln\Gamma(y_i + 1) – ln\Gamma\left(\frac{1}{\alpha}\right) + \left(\frac{1}{\alpha}\right)ln\left(\frac{1}{1 + \alpha\mu_{i}}\right) + y_iln\left(1 – \frac{1}{1 + \alpha\mu_{i}}\right) \right] &\mbox{if } y_{i} > 0 \end{array} \right.$$

where $$y_i$$ is the observed count, $$p_i$$ is the probability from the logistic zero-inflation part of the model, $$\alpha$$ is the dispersion parameter for the negative-binomial model, and $$\mu_i$$ is the mean conditional on covariate values for the negative-binomial model. The $$\mu_i$$ are typically modeled with a log link; see this page among others. Predictors for the logistic and negative-binomial parts of the model can differ.

• The examples you provided were very helpful. But it still didn't help me grasp how to write the model equation in terms of GLM with the exposure (offset). Jun 29, 2022 at 15:18
• @Leonor handling a continuous offset depends on the GLM link function. With a log link you include a term offset(log(exposure)) in the negative binomial (NB) portion of the model. See here, for example. If you use the method in the UCLA web page I linked, you don't need to use $(1-\pi)\mu$ in your NB model specification; the combined model iteratively estimates $\pi$ from the zero-inflation part and takes that into account for the NB part during the expectation-maximization (EM) process.
– EdM
Jun 29, 2022 at 17:03
• the R code for ZINB models includes two components. The first is the actual NB component (which includes (Intercept) and Log(theta) ) and the second is the zero (logit) component (only (Intercept) as I didn't specify any covariates). I am correct? So for the expect value for my ZINB model I should only consider the first block? And it would be E(Y) = exp((Intercept) + Log(theta) )? Jun 30, 2022 at 16:11
• @Leonor I get confused by different parameterizations of negative binomials. The UCLA OARC web page is what you should trust on this. Also note that the emmeans package supports zeroinfl models, which can relieve you from trying to do such calculations yourself and minimize the chance of inadvertent errors.
– EdM
Jun 30, 2022 at 16:33
• To write the parameterization I was guiding myself on the references on the pscl package (What I mentioned in the question). But still, very confusing for me as well. That package finally gave me what I was hoping for! Thank you so much. Jun 30, 2022 at 20:45