Zero-Inflated Poisson (ZIP) and Zero-Inflated Negative Binomial (ZINB) Regression
These models put the two processes that produce zeros into a single model.
Suppose you are analyzing how many times mobile game users buy paid items. Some users buy paid items several times in a month, but many users never buy anything.
But the users with 0 purchases may not all have failed to buy for the same reason. Some may have almost no intention of buying paid items, while others usually buy but didn't this month because there was no item they needed.
When a result of zero may come from different processes like this, one method you can consider is the zero-inflated regression model.
The best-known examples are zero-inflated Poisson regression (ZIP) and zero-inflated negative binomial regression (ZINB).
Both models combine a separate state that produces zeros with a state in which the number of events is determined by an ordinary count distribution. The difference is whether the count part uses a Poisson or a negative binomial distribution.
In this article we look at the basic principles of ZIP and ZINB, a worked analysis example, the two-part regression model, interpreting coefficients and predictions, and how to choose and diagnose models.
What is a zero-inflated regression model?
A zero-inflated regression model is a mixture model you consider when an ordinary count model alone has trouble explaining how often zeros occur.
For example, suppose you analyzed game users' monthly purchases with Poisson regression, and the model predicted that 35% of all users would have 0 purchases, but in the actual data 65% made no purchase.
In this case, the ordinary Poisson model may not adequately explain how often zeros occur. To explain this situation, a zero-inflated model assumes that observations arise from two latent states.
The first is a state that always produces 0. The second is a state in which 0 events or 1 or more events occur according to an ordinary count distribution. The important point is that 0 can also appear in the second state. So a zero-inflated model does not classify every zero as the result of a user who never buys.
However, you should not conclude that a zero-inflated model is needed just because the proportion of zeros is high. Zeros can occur naturally in ordinary Poisson and negative binomial distributions too.
What are the two processes that produce zeros?
Let's take mobile game users' purchase counts as an example.
Some users may play the game only for free and have almost no intention of buying paid items. Other users might buy, but may record 0 purchases because there was no item they wanted that month or no chance to buy. A zero-inflated model expresses this as the following two latent states.
| Category | State | Observable number of purchases |
|---|---|---|
| Structural-zero state | A state in which no purchases occur | Always 0 |
| Count state | A state in which the number of purchases is determined by a probability distribution | 0, 1, 2, … |
For example, even if a user recorded 0 purchases, you cannot tell exactly from the observation alone whether that person belongs to the structural-zero state or happened to record 0 in the count state. The model reflects this uncertainty by estimating the probability of each state and the count distribution.
So the structural-zero state of a zero-inflated model should not be taken as a confirmed group of 'users who never buy.' It is a latent probabilistic state set up for the analysis.
How do ZIP and ZINB differ?
ZIP and ZINB are both two-part zero-inflated models.
The first part estimates the probability of belonging to the structural-zero state. The second part estimates the distribution of purchase counts for users in the count state. The difference between the two models is the probability distribution used in the second part.
| Category | ZIP | ZINB |
|---|---|---|
| Full name | Zero-Inflated Poisson | Zero-Inflated Negative Binomial |
| Structural-zero part | Binary choice model | Binary choice model |
| Count part | Poisson distribution | Negative binomial distribution |
| Variance of the count part | Equal to the mean | Can exceed the mean |
| Suitable when | A separate zero-generating process and Poisson-type count variation | A separate zero-generating process and overdispersed count variation |
| Additional parameters | Structural-zero probability | Structural-zero probability and an overdispersion parameter |
ZIP uses a Poisson distribution, whose mean and variance are equal, in the count part. ZINB, on the other hand, uses a negative binomial distribution, so it allows a variance larger than the mean even in the count state. So if the data have both structural zeros and overdispersion, you can consider ZINB.
But ZINB is not always better than ZIP. If the data have a relatively simple structure, there may be no need to use ZINB with its additional parameter.
Real-world case: paid item purchases in a mobile game
Suppose a mobile game operator analyzed the paid item purchase records of 2,000 users who were active in the past month.
The operator wants to understand how free users and paying users behave differently, and how play time and event participation relate to the number of paid item purchases.
Analysis data
| Item | Details |
|---|---|
| Sample | 2,000 active users |
| Dependent variable | Monthly number of paid item purchases |
| Main predictor | Average weekly play time |
| Additional predictor | Event participation |
| Control variables | Account age, game level, etc. |
| Observation period | 1 month |
| Purpose of analysis | Analyze purchase counts and the structure that produces zeros |
Suppose the distribution of monthly purchases is as follows.
Distribution of purchase counts
| Monthly purchases | Number of users | Share |
|---|---|---|
| 0 | 1,300 | 65% |
| 1 | 300 | 15% |
| 2 | 180 | 9% |
| 3–4 | 140 | 7% |
| 5 or more | 80 | 4% |
| Total | 2,000 | 100% |
65% of all users did not buy any paid items during the month, while some users bought several times. The research question is as follows.
"How are play time and event participation each related to the latent state in which no purchases occur and to the actual number of paid item purchases?"
For these data, let's assume that the latent state with no purchases and the count state may be determined by different processes. In a real analysis, however, you should first check whether ordinary Poisson and negative binomial regression can adequately explain such a distribution.
How is a zero-inflated model built mathematically?
A zero-inflated model combines the probability of belonging to the structural-zero state with the mean number of events in the count state.
Let πi be the probability of belonging to the structural-zero state and μi the mean number of purchases in the count state. Then the distribution of all observations can be written as follows.
P(Yi = 0) = πi + (1 − πi)·f(0; μi)
P(Yi = y) = (1 − πi)·f(y; μi), y > 0
Here f(y; μi) is the probability mass function of the count part. ZIP uses a Poisson distribution, so P(Yi = 0) = πi + (1 − πi)·e−μi.
ZINB, on the other hand, uses the probability of zero from a negative binomial distribution instead of a Poisson distribution. In both models, the overall expected number of purchases can be computed as follows.
E[Yi] = (1 − πi) × μi
This formula shows that the overall expected number of purchases falls as the probability of belonging to the structural-zero state rises, and increases as the mean number of purchases in the count state rises.
How are the structural-zero probability and the count mean computed?
In a zero-inflated model, a separate regression equation is usually specified for each of the two parts.
Structural-zero part
The probability of belonging to the structural-zero state can be expressed with a logistic model.
log( πi ÷ (1 − πi) ) = Ziᵀγ
This part analyzes how play time, event participation, and so on relate to the likelihood of belonging to the structural-zero state.
Count part
The mean number of purchases in the count state can be expressed using a log link.
log(μi) = Xiᵀβ
This part analyzes how the expected number of purchases for users not in the structural-zero state changes with the predictors. For example, longer play time could lower the probability of belonging to the structural-zero state and raise the expected number of purchases in the count state.
But you don't have to put the same predictors in both parts. You can specify different predictors, taking into account the research purpose and the data-generating process.
How do you interpret actual ZIP regression results?
Suppose we applied ZIP regression to the mobile game data above.
The ZIP results table presents the coefficients for the structural-zero part and the count part separately.
Structural-zero part
| Variable | Regression coefficient (B) | Odds ratio (OR) | p-value |
|---|---|---|---|
| Weekly play time (5-hour increase) | -0.40 | 0.670 | < .001 |
| Event participation | -0.65 | 0.522 | .002 |
Count part
| Variable | Regression coefficient (B) | Incidence rate ratio (IRR) | p-value |
|---|---|---|---|
| Weekly play time (5-hour increase) | 0.25 | 1.284 | < .001 |
| Event participation | 0.35 | 1.419 | .001 |
In the structural-zero part, the coefficient for play time was -0.40. The odds ratio is e−0.40 ≈ 0.670. This means that, with other conditions equal, 5 more hours of weekly play time was associated with about 33.0% lower odds of belonging to the structural-zero state.
The odds ratio for event participation was about 0.522. So users who participated in the event had about 47.8% lower odds of belonging to the structural-zero state than users who did not.
Note that an odds ratio is not the same as a ratio of actual purchase probabilities. Also, the results for the structural-zero part should not be interpreted directly as changes in the purchase probability of all users.
In the count part, the coefficient for play time is 0.25, and the incidence rate ratio is e0.25 ≈ 1.284. This means that in the count state, 5 more hours of weekly play time was associated with about 28.4% more expected purchases.
The IRR for event participation is 1.419, indicating about 41.9% more expected purchases in the count state. As this shows, in ZIP regression the same predictor can have different relationships in the structural-zero part and the count part.
How is interpreting ZINB results different from ZIP?
Suppose the variance of the count state in the data above turned out to be larger than the Poisson assumption allows.
In this case you can apply ZINB instead of ZIP. ZINB also presents results separately for the structural-zero part and the count part. So the basic way of interpreting the odds ratios of the structural-zero part and the incidence rate ratios of the count part is the same as in ZIP. However, ZINB additionally estimates a parameter that describes overdispersion in the count part.
Example ZINB results
| Item | Estimate |
|---|---|
| Structural-zero part OR for play time | 0.72 |
| Structural-zero part OR for event participation | 0.58 |
| Count part IRR for play time | 1.22 |
| Count part IRR for event participation | 1.35 |
| Overdispersion parameter α | 0.80 |
If the structural-zero part OR for play time is 0.72, 5 more hours of play time was associated with about 28% lower odds of belonging to the structural-zero state. If the count part IRR is 1.22, 5 more hours of play time was associated with about 22% more expected purchases in the count state.
The overdispersion parameter α describes how much variance larger than the mean is allowed in the count part. How to interpret this value can depend on the variance function of the negative binomial model used.
However, the fact that the overdispersion parameter is positive does not by itself establish that ZINB is more appropriate than ZIP. You should review the two models' fit, predictive performance, and stability together.
How do you predict the overall number of purchases?
In zero-inflated regression, it is important to interpret the coefficients of the structural-zero part and the count part separately, but it is also useful to compute the number of purchases actually expected.
For example, suppose the following predictions were obtained for a particular user.
| Item | Predicted value |
|---|---|
| Structural-zero state probability π | 0.60 |
| Count state probability 1 − π | 0.40 |
| Mean number of purchases in the count state μ | 3.0 |
The overall expected number of purchases is computed as (1 − 0.60) × 3.0 = 1.2. Here 1.2 does not mean that fractional purchases actually happen; it represents the expected number of purchases for users with the same conditions.
Also, even when the overall expected number of purchases is the same, the structural-zero probability and the mean of the count part can differ. So depending on the research purpose, it is good to check the predictions of both parts together.
Which should you choose, ZIP or ZINB?
When choosing a zero-inflated model, first check how well ordinary Poisson and negative binomial regression explain the proportion of zeros and the overall distribution of the data.
That's because even when there are many zeros, negative binomial regression alone can sometimes explain them adequately. When choosing a model, you can compare the following items.
| Item to check | What to look at |
|---|---|
| Predicted proportion of zeros | Is the model's predicted proportion similar to the actual proportion of zeros? |
| Distribution of positive counts | Does it adequately explain the distribution of users who bought 1 or more times? |
| Overdispersion | Is the variation in the count part larger than the Poisson assumption? |
| AIC·BIC | Considering fit and complexity, which model is preferable? |
| Predictive performance | Does it predict purchase counts and the occurrence of zeros well on new data? |
| Model stability | Are the coefficients and standard errors not overly unstable? |
For example, if ZINB has a lower AIC than ZIP and also explains the distribution of positive purchase counts better, ZINB is likely to be appropriate. But rather than reaching a final conclusion from information criteria alone, it is important to check whether the two-part model fits actual purchasing behavior.
Also, because zero-inflated models have a complex structure, some coefficients may be estimated as very large or convergence problems may occur. In such cases, you should revisit the model specification.
How do zero-inflated models and hurdle models differ?
A method considered alongside zero-inflated models when analyzing count data with many zeros is the hurdle model.
Both methods distinguish zeros from positive counts, but they differ in the structure that generates the data. A zero-inflated model assumes a structural-zero state and an ordinary count state, and zeros can also occur in the count state.
A hurdle model, by contrast, first determines whether the event happened at least once, and only for positive outcomes analyzes the count with a truncated count distribution that excludes zero.
| Category | Zero-inflated model (ZIP, ZINB) | Hurdle model |
|---|---|---|
| How zeros arise | Possible in both the structural-zero state and the count state | Determined in the first stage |
| Positive counts | Positive part of an ordinary count distribution | Truncated count distribution excluding 0 |
| Main interpretation | Structural-zero probability and the mean of the count state | Whether the event occurs and how many times when it does |
| Perspective | Mixture of different latent states | Decision process of moving from 0 to a positive count |
For example, if in a mobile game users first decide whether to make a paid purchase and only those who decide to buy then determine how many times, a hurdle model may be natural. On the other hand, if it makes more sense to view the data as a mixture of a latent state with no purchases and a state in which purchases are possible, you can consider a zero-inflated model.
However, the two models can explain the observed distribution similarly, so you should consider both the actual data-generating process and the purpose of the analysis.
Cautions with zero-inflated regression
Don't choose a zero-inflated model just because there are many zeros.
Zeros can occur naturally in Poisson and negative binomial distributions too. So first check whether a standard count model adequately explains the actual proportion of zeros.
Don't treat the structural-zero state as a confirmed type of user.
The two states of a zero-inflated model are latent states assumed statistically. You cannot establish from an observed zero alone whether a particular user is someone who never buys.
Distinguish the coefficients of the two parts.
The structural-zero part is interpreted with logistic regression coefficients, and the count part with regression coefficients using a log link. So it is good to compute and explain odds ratios and incidence rate ratios, respectively.
Don't confuse effects on the overall mean with effects on the count part.
The IRR of the count part is a relative change in the mean of the count state. The effect on the expected number of purchases for all users must also take into account the change in the structural-zero probability.
Check overdispersion and model fit together.
ZIP uses a Poisson distribution in the count part, so if overdispersion is large you may need to consider ZINB or similar models. However, ZINB is not always more appropriate.
Don't assume observed relationships are causal effects.
Just because users who took part in an event made more purchases, you can't conclude that participating in the event itself increased purchases. Users with a strong tendency to buy may also have been more likely to take part in events.
How do you report ZIP and ZINB results?
When reporting zero-inflated regression results, it is good to present the proportion of zeros and the characteristics of the count data, the reasons for model choice, the regression coefficients of the structural-zero part and the count part, key predictions, and so on.
Also, if you compared ZIP and ZINB, you should report information on overdispersion and model fit.
Example report
Zero-inflated regression analysis was conducted to examine factors associated with the number of paid item purchases by mobile game users. The sample consisted of 2,000 users active in the past month, of whom 1,300 (65%) did not buy any paid items. Given the many zeros observed in purchase counts, ZIP and ZINB models were compared.
In the ZINB model, 5 more hours of weekly play time was associated with lower odds of belonging to the structural-zero state (OR = 0.72). In the count part, by contrast, 5 more hours of play time was associated with about 22% more expected purchases (IRR = 1.22). Event participation was likewise negatively associated with the odds of the structural-zero state (OR = 0.58) and positively associated with the expected number of purchases in the count part (IRR = 1.35). These results suggest that play time and event participation are related in different ways to the latent state in which no purchases occur and to the number of purchases in the count state.
In real research, you should also present the 95% confidence interval and p-value of each coefficient, the overdispersion parameter, model fit, and whether the model converged. Comparing the proportion of zeros predicted by the model with the proportion actually observed also helps assess how well the zero-inflated model fits.
Zero-inflated models account separately for the process that produces zeros.
ZIP and ZINB are methods for analyzing structures of zero occurrence in count data that are hard to explain with an ordinary Poisson or negative binomial model alone.
Both models combine the probability of belonging to the structural-zero state with the number of events in an ordinary count state. An important feature is that zeros can also occur in the count state. ZIP uses a Poisson distribution for the count part, while ZINB uses a negative binomial distribution to allow overdispersion.
The results can be interpreted separately as odds ratios for the structural-zero part and incidence rate ratios for the count part. But to understand the effect on the overall expected number of purchases, you need to consider both parts together.
Also, using a zero-inflated model just because there are many zeros is not appropriate. Compare it with alternative models such as Poisson and negative binomial regression and hurdle models, and choose the method that fits the actual data-generating process.
The core of zero-inflated regression is not the fact that many zeros appear in itself, but explaining the latent process that produces zeros together with the distribution of event counts.