Tutorials › Biostatistics › Zero-Inflated Models for Clinical Count Outcomes

Count Data & Regression

Zero-Inflated Models for Clinical Count Outcomes

A practical guide to modeling clinical count outcomes with more zeros than standard Poisson or negative binomial models can accommodate, including zero-inflated Poisson and negative binomial models, structural versus sampling zeros, model interpretation, likelihoods, diagnostics, model selection, and implementation in R.

Advanced 18 min read

What You'll Learn

  • Why ordinary Poisson models can fail when clinical count outcomes contain excess zeros
  • The distinction between structural zeros and sampling zeros
  • How zero-inflated Poisson and zero-inflated negative binomial models are constructed
  • How to interpret the count and zero-inflation components
  • How to compare ZIP, ZINB, Poisson, and negative binomial models
  • How to fit, interpret, diagnose, and report zero-inflated models in R

Introduction

Clinical research frequently produces outcomes that are naturally represented as counts: number of exacerbations, hospitalizations, falls, infections, rescue-medication uses, disease flares, seizures, bleeding events, or other recurrent events during a specified observation period.

A natural starting point for count data is the Poisson regression model. However, an important complication occurs when the observed dataset contains far more zero counts than a standard Poisson distribution would reasonably predict.

For example, suppose the number of disease exacerbations during follow-up is:

Number of Events Number of Patients
0 142
1 34
2 15
3 6
4+ 3

A very large fraction of participants have zero events.

That does not automatically mean that a zero-inflated model is required. Excess zeros can arise for several different reasons, and some can be handled by ordinary Poisson or negative binomial models.

The key modeling question is: Does the data-generating process contain a distinct mechanism that produces zeros in addition to the ordinary count-generating process?

Key idea: A zero-inflated model treats the observed population as a mixture of two processes: one process produces individuals who are certain to have a zero, while the other process generates counts—including additional zeros—according to a Poisson or negative binomial distribution.

Why Count Data Are Different

A count outcome takes values such as:

  • 0 events
  • 1 event
  • 2 events
  • 3 events
  • and so forth.

Counts are therefore fundamentally different from continuous outcomes such as blood pressure or laboratory measurements.

They are also different from binary outcomes. A patient with three exacerbations is not simply three times as severe as a patient with one exacerbation in every clinical setting, but the numerical count still contains information that would be lost if it were reduced to a binary indicator.

Poisson regression provides one important framework for analyzing such outcomes.

The Poisson Model

Suppose: \(Y_i\) is the number of clinical events observed for patient \(i\). The Poisson model assumes:

\[ Y_i\sim\operatorname{Poisson}(\mu_i) \]

where: \(\mu_i\) is the expected number of events for patient \(i\).

The probability of observing exactly \(y\) events is:

\[ P(Y_i=y) = \frac{e^{-\mu_i}\mu_i^y}{y!} \]

The Poisson regression model relates the expected count to covariates using a log link:

\[ \log(\mu_i) = \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik} \]

Equivalently:

\[ \mu_i = \exp\left( \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik} \right) \]

The exponential transformation guarantees that the predicted mean remains positive.

The Poisson Mean-Variance Assumption

A defining property of the Poisson distribution is:

\[ E(Y)=\mu \]

and:

\[ \operatorname{Var}(Y)=\mu \]

Thus, the Poisson model assumes that the variance and mean are equal.

Clinical count data frequently violate this assumption.

If:

\[ \operatorname{Var}(Y)>\operatorname{E}(Y) \]

the data are overdispersed.

A negative binomial model is often a more appropriate alternative in that situation.

But What If There Are Too Many Zeros?

Suppose the estimated mean number of events is only 0.5. Under a Poisson model:

\[ P(Y=0)=e^{-0.5}\approx0.6065 \]

So approximately 60.7% zeros would be expected.

If the observed proportion of zeros is 80%, the Poisson model may substantially underestimate the zero probability.

There are several possible explanations.

  • The data may be overdispersed.
  • The population may contain multiple clinical subgroups.
  • Some individuals may be effectively unable to experience the event.
  • The observation period may be inappropriate for the assumed model.
  • The covariates may fail to explain important heterogeneity.
  • A zero-inflated or hurdle model may be appropriate.
Important: An unusually large number of zeros is a diagnostic signal, not by itself proof that a zero-inflated model is required.

Structural Zeros Versus Sampling Zeros

This distinction is central to zero-inflated modeling.

Structural Zeros

A structural zero comes from an individual who belongs to a subgroup for which the event count is effectively zero by definition of the underlying process.

For example, suppose a clinical study counts the number of treatment-related adverse events among patients. A patient who never receives the treatment cannot experience a treatment-related adverse event during treatment exposure. That patient might belong to a structural-zero group for that particular outcome.

Sampling Zeros

A sampling zero occurs naturally from the ordinary count distribution.

A patient who is genuinely at risk of experiencing events may simply have no events during follow-up.

For example, a patient who is susceptible to disease exacerbations may experience zero exacerbations during the observation period. That is an ordinary zero from the count-generating process.

The conceptual distinction: A zero-inflated model assumes that some zeros arise from a separate zero-generating process, while other zeros arise naturally from the ordinary count distribution.

The Mixture Interpretation

Let: \(Z_i\) represent membership in the zero-inflated component. Define:

\[ Z_i= \begin{cases} 1, & \text{structural-zero state}\\ 0, & \text{count-generating state} \end{cases} \]

Let: \(\pi_i=P(Z_i=1)\) be the probability that patient \(i\) belongs to the structural-zero group.

Then:

\[ P(Z_i=1)=\pi_i \]

and:

\[ P(Z_i=0)=1-\pi_i \]

The remaining \(1-\pi_i\) patients follow an ordinary count distribution.

This produces a two-component mixture.

1
Zero-inflation process: determine whether the patient belongs to the structural-zero group.
2
Count process: if the patient is not in the structural-zero group, generate the observed count from a Poisson or negative binomial distribution.
3
Observed outcome: combine the two processes to obtain the patient's observed count.

Zero-Inflated Poisson Model

The simplest zero-inflated count model is the zero-inflated Poisson, or ZIP, model.

The count component follows:

\[ Y_i\mid Z_i=0 \sim \operatorname{Poisson}(\mu_i) \]

while the structural-zero component produces:

\[ Y_i=0 \qquad\text{if }Z_i=1 \]

The probability of zero is therefore:

\[ P(Y_i=0) = \pi_i+(1-\pi_i)e^{-\mu_i} \]

For a positive count:

\[ P(Y_i=y) = (1-\pi_i) \frac{e^{-\mu_i}\mu_i^y}{y!}, \qquad y>0 \]

The observed zero probability contains two contributions:

  1. Structural zeros from the zero-inflation process.
  2. Ordinary Poisson zeros from the count process.

Why Positive Counts Are Different

For any positive count, a structural-zero patient cannot contribute. Therefore:

\[ P(Y_i=y>0) = (1-\pi_i)P_{\text{Poisson}}(Y_i=y) \]

This is an important feature of the ZIP likelihood.

Positive counts provide information primarily about the count-generating component, while zeros contain information about both components.

The ZIP Regression Model

The zero-inflation probability can depend on covariates through a logistic regression model:

\[ \operatorname{logit}(\pi_i) = \gamma_0+\gamma_1W_{i1}+\cdots+\gamma_qW_{iq} \]

where: \(W\) variables explain membership in the structural-zero group.

The count component uses:

\[ \log(\mu_i) = \beta_0+\beta_1X_{i1}+\cdots+\beta_kX_{ik} \]

The two sets of covariates do not have to be identical.

Two regression models are being fitted: the logistic model predicts the probability of structural-zero membership, while the Poisson model predicts the event rate among the count-generating population.

Interpreting the Zero-Inflation Component

Suppose the zero-inflation model is:

\[ \operatorname{logit}(\pi) = \gamma_0+\gamma_1\operatorname{Treatment} \]

Then:

\[ e^{\gamma_1} \]

is an odds ratio for membership in the structural-zero group.

If:

\[ e^{\gamma_1}=2 \]

then the treatment group has twice the odds of belonging to the structural-zero state compared with the reference group, conditional on the model.

This is not automatically an odds ratio for having zero observed events.

Common interpretation error: The zero-inflation coefficient describes the odds of membership in the zero-generating component—not simply the odds of observing zero events.

Interpreting the Count Component

Suppose the count model is:

\[ \log(\mu_i) = \beta_0+\beta_1\operatorname{Treatment}_i \]

Then:

\[ e^{\beta_1} \]

is the multiplicative effect on the expected count within the count-generating component.

For example, if:

\[ e^{\beta_1}=0.70 \]

the expected event count in the treatment group is estimated to be 30% lower than in the reference group within the non-structural-zero population.

Zero-Inflated Negative Binomial Model

The ZIP model still assumes that the count-generating component is Poisson. That means:

\[ \operatorname{Var}(Y)=\operatorname{E}(Y) \]

within that component.

If the count-generating process is overdispersed, a zero-inflated negative binomial, or ZINB, model may be more appropriate.

The structural-zero process is unchanged. The difference is that the count component follows a negative binomial distribution rather than a Poisson distribution.

\[ Y_i\mid Z_i=0 \sim \operatorname{NB}(\mu_i,\theta) \]

where: \(\theta\) is a dispersion parameter under one common parameterization.

Negative Binomial Variance

One common parameterization gives:

\[ \operatorname{Var}(Y_i) = \mu_i+\frac{\mu_i^2}{\theta} \]

Thus:

\[ \operatorname{Var}(Y_i)>\mu_i \]

whenever the dispersion parameter is finite.

This makes the negative binomial model substantially more flexible for clinical count outcomes with heterogeneity in event rates.

ZIP Versus ZINB

Feature ZIP ZINB
Structural-zero component Yes Yes
Count component Poisson Negative binomial
Allows overdispersion Limited Yes
Additional dispersion parameter No Yes
Typical complexity Lower Higher

If the data contain both excess zeros and substantial overdispersion, ZINB is often a natural candidate.

But it should not be selected automatically merely because it has greater flexibility.

The Expected Count in a Zero-Inflated Model

For the ZIP model, the unconditional expected count is:

\[ E(Y_i) = (1-\pi_i)\mu_i \]

This equation is extremely important.

The count component mean is:

\[ \mu_i \]

but the overall population mean is:

\[ (1-\pi_i)\mu_i \]

because a proportion \(\pi_i\) of patients are assigned to the structural-zero component.

Key distinction: The coefficient in the count model does not directly describe the change in the unconditional mean count when the zero-inflation probability also changes.

The Variance of a ZIP Model

The zero-inflated mixture also changes the variance. For a ZIP model:

\[ \operatorname{Var}(Y) = (1-\pi)\mu \left[ 1+\pi\mu \right] \]

Equivalently:

\[ \operatorname{Var}(Y) = (1-\pi)\mu + \pi(1-\pi)\mu^2 \]

The mixture mechanism can therefore generate substantial overdispersion even though the count component itself is Poisson.

ZIP Can Produce Overdispersion

This leads to an important practical point.

A dataset can show:

  • excess zeros,
  • overdispersion,
  • and apparent variance greater than the mean

even if the non-structural-zero component is Poisson.

Therefore, observing overdispersion does not automatically mean that ZINB is required.

The correct question is whether the mixture structure adequately describes the data and whether additional negative-binomial dispersion is necessary.

The Zero Probability Under ZIP

The ZIP probability of zero is:

\[ P(Y=0) = \pi+(1-\pi)e^{-\mu} \]

Compare this with the ordinary Poisson probability:

\[ P_{\text{Poisson}}(Y=0)=e^{-\mu} \]

Because:

\[ \pi+(1-\pi)e^{-\mu} > e^{-\mu} \]

whenever: \(0<\pi<1\) and: \(\mu>0\).

The zero-inflation component therefore increases the probability of observing zero.

A Simple Numerical Example

Suppose:

\[ \pi=0.40 \qquad \mu=1.2 \]

Under an ordinary Poisson model:

\[ P(Y=0)=e^{-1.2}\approx0.3010 \]

Under ZIP:

\[ P(Y=0) = 0.40+ (0.60)e^{-1.2} \]
\[ P(Y=0)\approx0.5806 \]

Thus, the structural-zero mechanism increases the zero probability from approximately 30.1% to approximately 58.1%.

The unconditional expected count is:

\[ E(Y) = (1-0.40)(1.2) = 0.72 \]

So the count-generating population has mean 1.2, but the entire population has an expected count of only 0.72.

Why the Model Has Two Parts

The two components answer different scientific questions.

Component Question
Zero-inflation model Who is likely to belong to the structural-zero state?
Count model Among those in the count-generating state, how does the expected number of events vary?

This distinction can be particularly useful in clinical research where there is a meaningful subgroup that is not susceptible to the event being counted.

When a Zero-Inflated Model Makes Scientific Sense

A zero-inflated model is most compelling when the investigator can articulate a plausible mechanism for two types of zeros.

Examples may include:

  • Patients not at risk for a particular recurrent event.
  • Patients who cannot experience an event because of a clinical state.
  • Subjects with no opportunity for exposure during the observation period.
  • Populations containing a genuine non-susceptible subgroup.
  • Clinical settings where one process generates "certain zeros" and another process generates event counts.
Do not use zero inflation simply because the histogram contains many zeros. A biological or clinical rationale for the mixture structure should accompany the statistical evidence.

Zero Inflation Is Not the Same as Overdispersion

These concepts are related but not identical.

Overdispersion

Overdispersion means that the variance is larger than expected under the Poisson model.

\[ \operatorname{Var}(Y)>\operatorname{E}(Y) \]

Zero Inflation

Zero inflation means that the observed zero frequency is greater than expected under the assumed count distribution.

A dataset can have:

  • overdispersion without meaningful zero inflation,
  • zero inflation with a Poisson count component,
  • both zero inflation and overdispersion,
  • or neither.

Poisson, Negative Binomial, ZIP, and ZINB

Model Excess Zeros Overdispersion Mixture Structure
Poisson No No No
Negative binomial Can accommodate some excess zeros Yes No
ZIP Yes Yes, through mixture Yes
ZINB Yes Yes Yes

The negative binomial deserves special emphasis.

A negative binomial model can sometimes fit a dataset with many zeros quite well without requiring a separate zero-generating component.

Therefore, the relevant comparison may be:

A
Poisson model
B
Negative binomial model
C
Zero-inflated Poisson model
D
Zero-inflated negative binomial model

Hurdle Models Are Different

Another model commonly considered for excessive zeros is the hurdle model.

Although hurdle and zero-inflated models are sometimes discussed together, they represent different data-generating structures.

A hurdle model separates:

  1. The probability of crossing from zero to a positive count.
  2. The distribution of the positive counts after crossing the hurdle.

In a typical hurdle model, the positive-count component is truncated at zero.

A zero-inflated model, in contrast, allows the ordinary count component itself to generate zeros.

Feature Zero-Inflated Hurdle
Separate zero process Yes Yes
Count component can generate zeros Yes No
Positive counts modeled by zero-truncated distribution No Yes
Useful when zero vs. positive process is primary Sometimes Often

When Might a Hurdle Model Be More Natural?

Suppose the clinical question is: What determines whether a patient experiences any event at all, and among patients who experience at least one event, what determines the number of events?

That conceptual structure may favor a hurdle model.

If instead there is a scientifically meaningful group of patients who are structural zeros while the remaining population follows a conventional count distribution that itself permits zeros, a zero-inflated model may be more appropriate.

A Clinical Worked Example

Suppose a randomized clinical trial evaluates the effect of treatment on the number of disease exacerbations during 12 months.

Assume:

  • 600 patients are randomized.
  • The outcome is the number of exacerbations during follow-up.
  • Some patients are considered effectively non-susceptible to exacerbation.
  • Among susceptible patients, exacerbation counts are heterogeneous.

The observed data might look like:

Exacerbations Patients
0 410
1 94
2 47
3 25
4 12
5+ 12

The zero proportion is:

\[ \frac{410}{600} = 0.6833 \]

or approximately 68.3%.

A zero-inflated model may be considered if there is a strong clinical reason to believe that some patients are structurally unlikely to experience an exacerbation.

Including Treatment in Both Components

One possible model is:

\[ \log(\mu_i) = \beta_0+ \beta_1\operatorname{Treatment}_i+ \beta_2\operatorname{Age}_i \] \[ \operatorname{logit}(\pi_i) = \gamma_0+ \gamma_1\operatorname{Treatment}_i+ \gamma_2\operatorname{BaselineRisk}_i \]

Treatment can therefore affect both:

  • the probability of being in the structural-zero group, and
  • the expected event count among patients in the count-generating group.

Whether treatment belongs in both components should be determined by the scientific question and prespecified modeling strategy.

Why Covariates Can Differ Between Components

Suppose baseline disease severity predicts how many exacerbations a patient experiences but does not determine whether the patient belongs to the structural-zero subgroup.

Then baseline severity might appear in the count model but not the zero-inflation model.

Conversely, a variable might predict susceptibility to the event without strongly affecting the event rate among susceptible patients.

Thus:

\[ X\neq W \]

is entirely permissible, where \(X\) denotes count-model covariates and \(W\) denotes zero-inflation covariates.

Exposure Time Must Be Considered

Clinical count outcomes frequently involve different follow-up times.

A patient followed for 12 months has more opportunity to experience events than a patient followed for only three months.

For rate-based analyses, an offset can account for different exposure times.

For example:

\[ \log(\mu_i) = \log(T_i) + \beta_0+ \beta_1X_i \]

where: \(T_i\) is the patient's exposure time.

The term:

\[ \log(T_i) \]

is treated as an offset with coefficient fixed at one.

Clinical trial consideration: If follow-up duration differs meaningfully across participants, ignoring exposure time can confound treatment effects with unequal opportunity to experience events.

Rate Ratios

When the count component uses an exposure offset, exponentiated coefficients can often be interpreted as incidence rate ratios.

For treatment:

\[ IRR=e^{\beta_1} \]

An: \(IRR=0.75\) indicates a 25% lower modeled event rate in the treatment group within the count-generating component, holding other covariates constant.

Again, this interpretation applies to the count component and should not be confused with the unconditional population-level event rate.

Likelihood of the ZIP Model

For an observation with: \(y_i=0\), the likelihood contribution is:

\[ L_i = \pi_i+ (1-\pi_i)e^{-\mu_i} \]

For: \(y_i>0\):

\[ L_i = (1-\pi_i) \frac{e^{-\mu_i}\mu_i^{y_i}}{y_i!} \]

The full likelihood is:

\[ L(\boldsymbol{\beta},\boldsymbol{\gamma}) = \prod_{i=1}^{n}L_i \]

Estimation is typically performed by maximum likelihood.

Why Maximum Likelihood Is Important

The two components are not estimated independently by simply fitting one model to the zeros and another model to the positive counts.

The parameters are estimated jointly through the mixture likelihood.

This is important because the observed zeros contain information about both the structural-zero and count-generating mechanisms.

Important: The latent structural-zero status is generally unobserved. The model estimates its probability rather than simply labeling every zero as structural.

Latent Class Interpretation

The zero-inflation state can be thought of as a latent class.

For a patient with zero events, we do not directly observe whether the patient is:

  • a structural zero, or
  • a count-process zero.

The model estimates the probability of each possibility.

This latent-class interpretation is useful clinically but should not be overstated.

A statistical mixture model does not automatically prove that two biologically distinct subpopulations actually exist.

Predicted Probability of a Structural Zero

For an observed zero, the probability that the patient belongs to the structural-zero component can be obtained using Bayes' rule.

For ZIP:

\[ P(Z_i=1\mid Y_i=0) = \frac{\pi_i} {\pi_i+(1-\pi_i)e^{-\mu_i}} \]

This probability is generally different from:

\[ P(Z_i=1)=\pi_i \]

because observing a zero provides additional information.

Example of Posterior Structural-Zero Probability

Suppose:

\[ \pi=0.40 \qquad \mu=1.2 \]

Then:

\[ P(Z=1\mid Y=0) = \frac{0.40} {0.40+(0.60)e^{-1.2}} \]

which is approximately:

\[ P(Z=1\mid Y=0) \approx0.689 \]

Thus, among patients observed to have zero events, the estimated probability of structural-zero membership is approximately 68.9%, even though the unconditional structural-zero probability is only 40%.

R Implementation

Several R packages can fit zero-inflated count models. A commonly used framework is the pscl package, while glmmTMB provides a flexible framework for zero-inflated Poisson and negative binomial models and extensions.

The following examples use glmmTMB because it provides a convenient syntax for specifying both the count and zero-inflation components.

install.packages("glmmTMB")

library(glmmTMB)

Example Dataset

Suppose the dataset contains:

  • exacerbations = number of exacerbations
  • treatment = treatment group
  • age = baseline age
  • severity = baseline disease severity
  • followup = exposure time in years

A basic ZIP model is:

zip_model <- glmmTMB(
  exacerbations ~ treatment + age + severity,
  ziformula = ~ treatment + severity,
  family = poisson,
  data = dat
)

summary(zip_model)

Understanding the Formula

The first formula:

exacerbations ~ treatment + age + severity

defines the count component.

The second:

ziformula = ~ treatment + severity

defines the zero-inflation component.

The two formulas are allowed to differ.

Adding an Exposure Offset

If the outcome represents an event rate and follow-up duration differs between patients, an offset can be included:

zip_rate <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  ziformula = ~ treatment + severity,
  family = poisson,
  data = dat
)

summary(zip_rate)

The offset accounts for different amounts of time at risk.

Fitting a Zero-Inflated Negative Binomial Model

A ZINB model can be fitted by changing the family:

zinb_model <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  ziformula = ~ treatment + severity,
  family = nbinom2,
  data = dat
)

summary(zinb_model)

The nbinom2 parameterization models variance as a function proportional to the square of the mean.

Another negative-binomial parameterization is available through nbinom1, in which the variance has a different relationship to the mean.

Modeling detail: The choice between negative-binomial parameterizations should be made based on the scientific context, variance structure, diagnostics, and modeling conventions rather than treated as a purely cosmetic software choice.

Fitting a Standard Poisson Model

For comparison:

poisson_model <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  family = poisson,
  data = dat
)

summary(poisson_model)

A standard generalized linear model can also be fitted using:

poisson_glm <- glm(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  family = poisson,
  data = dat
)

summary(poisson_glm)

Fitting a Standard Negative Binomial Model

nb_model <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  family = nbinom2,
  data = dat
)

summary(nb_model)

This model provides an important benchmark for determining whether a separate zero-inflation component is actually useful.

Comparing Models with AIC

AIC can be used to compare non-identical likelihood-based models fitted to the same dataset.

AIC(
  poisson_model,
  nb_model,
  zip_rate,
  zinb_model
)

Lower AIC indicates a better trade-off between model fit and model complexity according to the AIC criterion.

Do not interpret AIC in isolation. A lower AIC does not prove that a model is clinically correct. Scientific plausibility, diagnostics, parameter stability, and predictive performance should also be considered.

Likelihood Ratio Testing

Likelihood ratio tests can sometimes be useful for nested models, but zero-inflated models have boundary and mixture-model considerations that can make standard asymptotic tests more complicated than an ordinary nested regression comparison.

Therefore, model selection should not be reduced to blindly applying a likelihood ratio test to every possible ZIP versus Poisson comparison.

AIC, BIC, residual diagnostics, predictive checks, and scientific justification can provide complementary evidence.

BIC

The Bayesian information criterion is:

\[ BIC=-2\log(L)+k\log(n) \]

where:

  • \(L\) = maximized likelihood
  • \(k\) = number of estimated parameters
  • \(n\) = sample size

BIC penalizes model complexity more strongly than AIC as sample size increases.

BIC(
  poisson_model,
  nb_model,
  zip_rate,
  zinb_model
)

Inspecting Model Coefficients

A model summary typically contains separate coefficient sections for:

  • conditional/count model parameters,
  • zero-inflation parameters,
  • and dispersion parameters for negative binomial models.

For example:

summary(zinb_model)

The coefficient estimates should therefore be interpreted according to which part of the model they belong to.

Exponentiating Count Coefficients

For a log-linked count model:

\[ IRR=e^\beta \]

In R:

exp(fixef(zinb_model)$cond)

This converts conditional-model coefficients from log scale to multiplicative effects.

Exponentiating Zero-Inflation Coefficients

For the logistic zero-inflation model:

\[ OR=e^\gamma \]

In R:

exp(fixef(zinb_model)$zi)

These are odds ratios for the zero-inflation component.

Always label the two sets of effects clearly. Reporting one table of exponentiated coefficients without identifying whether the estimates come from the count component or zero-inflation component can lead to serious interpretation errors.

Obtaining Confidence Intervals

Confidence intervals can be obtained from the fitted model.

confint(zinb_model)

For exponentiated effects:

ci <- confint(zinb_model)

exp(ci)

The exact presentation should distinguish the conditional and zero-inflation components.

Predicted Counts

Predicted outcomes are often more interpretable than raw regression coefficients.

For example:

newdat <- data.frame(
  treatment = factor(
    c("Control", "Treatment"),
    levels = levels(dat$treatment)
  ),
  age = mean(dat$age, na.rm = TRUE),
  severity = mean(dat$severity, na.rm = TRUE),
  followup = 1
)

predict(
  zinb_model,
  newdata = newdat,
  type = "response"
)

These predictions represent the modeled unconditional expected outcome, integrating the zero-inflation and count components.

Conditional Versus Unconditional Predictions

This distinction is especially important.

The count component predicts:

\[ \mu_i \]

while the ZIP unconditional expected count is:

\[ (1-\pi_i)\mu_i \]

A clinical report may be more interested in the unconditional population-level mean than in the conditional count-process mean.

Predicted Probability of Zero

The probability of zero under ZIP is:

\[ P(Y_i=0) = \pi_i+ (1-\pi_i)e^{-\mu_i} \]

Predicted probabilities can therefore be used to compare the expected frequency of zero events between treatment groups.

In practice, predicted probabilities are often easier for clinical readers to understand than the coefficients from the zero-inflation logistic model.

Residual Diagnostics

Model diagnostics are essential because mixture models can fit complicated distributions but can also be difficult to diagnose.

Useful diagnostic questions include:

  • Are zeros adequately predicted?
  • Are positive counts adequately predicted?
  • Is the variance structure appropriate?
  • Are there influential observations?
  • Does the model systematically underpredict large counts?
  • Does the model overpredict zeros?
  • Does the model reproduce the overall count distribution?

Observed Versus Predicted Counts

A simple diagnostic is to compare the observed and predicted distribution of counts.

For example:

pred <- predict(
  zinb_model,
  type = "response"
)

summary(pred)

More useful diagnostics compare the empirical distribution with simulated datasets generated from the fitted model.

Simulation-Based Diagnostics

For complex count models, simulation-based residual diagnostics can be particularly valuable.

The DHARMa package provides a commonly used framework for simulation-based residual diagnostics.

install.packages("DHARMa")

library(DHARMa)

sim_res <- simulateResiduals(
  fittedModel = zinb_model
)

plot(sim_res)

Additional diagnostics can include tests for dispersion and zero inflation.

testDispersion(sim_res)

testZeroInflation(sim_res)
Interpretation: A zero-inflation test is evidence about whether the fitted model leaves unexplained zero inflation. It is not a substitute for clinical reasoning about whether a structural-zero process exists.

Checking Dispersion

For a Poisson model, dispersion can be assessed approximately by comparing the residual variation with what the model expects.

A rough diagnostic quantity is:

\[ \hat{\phi} = \frac{\sum_i r_i^2}{n-p} \]

where: \(r_i\) represents an appropriate residual and \(p\) is the number of fitted parameters.

A value substantially above one can suggest overdispersion.

For zero-inflated models, however, diagnostics should account for the mixture structure rather than relying on a single simplistic dispersion ratio.

Model Selection Workflow

1
Understand the clinical mechanism generating the count.
2
Inspect the empirical distribution of counts and zeros.
3
Fit a Poisson reference model.
4
Assess overdispersion and model adequacy.
5
Fit a negative binomial reference model when appropriate.
6
Consider ZIP or ZINB when a separate zero-generating mechanism is scientifically plausible.
7
Compare model fit using AIC, BIC, diagnostics, and predictive performance.
8
Evaluate whether coefficients and predictions are clinically interpretable.
9
Prespecify the final model and sensitivity analyses.

Why a Negative Binomial Model Should Usually Be a Comparator

Suppose a dataset contains 70% zeros. It might be tempting to conclude: "There are many zeros, so we need a zero-inflated model."

That conclusion is premature.

A negative binomial distribution has greater variance than a Poisson distribution and can naturally generate a higher frequency of zeros.

Therefore, the appropriate comparison is often:

\[ \text{Poisson} \quad\text{vs.}\quad \text{Negative Binomial} \quad\text{vs.}\quad \text{ZIP} \quad\text{vs.}\quad \text{ZINB} \]

The best model should be chosen based on the entire distribution and the scientific interpretation, not only the number of zeros.

Common Clinical Applications

Zero-inflated count models can arise in many clinical research settings.

Clinical Outcome Potential Count
Respiratory disease Number of exacerbations
Neurology Number of seizures
Oncology Number of disease-related complications
Safety analysis Number of selected adverse events
Hospital utilization Number of hospitalizations
Healthcare utilization Number of emergency visits
Gastroenterology Number of disease flares
Pain research Number of breakthrough episodes
Infectious disease Number of infections

Whether zero inflation is appropriate depends on the clinical mechanism and study design.

Repeated Events and Zero-Inflated Models

Zero-inflated models can be useful for recurrent-event counts, but they do not automatically solve every problem associated with repeated events.

Repeated-event data can also involve:

  • different exposure times,
  • within-patient dependence,
  • time-varying risk,
  • event severity,
  • competing events,
  • terminal events that prevent future events.

If the scientific question concerns the timing of individual recurrent events, a survival or recurrent-event model may be more appropriate than reducing the entire follow-up period to one count.

Count models summarize event frequency. They do not preserve the exact timing of events within the observation period.

Zero Inflation Versus Recurrent-Event Survival Models

Suppose a patient experiences three hospitalizations. A count model records:

\[ Y=3 \]

but it does not distinguish between:

  • three hospitalizations in the first month, or
  • one hospitalization every four months.

Those patterns may have very different clinical implications.

If timing is scientifically important, a recurrent-event survival analysis may be preferable.

Zero Inflation and Exposure to Risk

Structural zeros can sometimes arise simply because a patient has no exposure to the process generating the event.

This raises an important modeling question: Is the patient truly a structural zero, or did the study design simply give that patient no opportunity to experience the event?

For example, a patient with very short follow-up may have zero events because of limited observation time rather than because they belong to a distinct zero-risk subgroup.

Exposure offsets and appropriate follow-up definitions should therefore be considered before introducing a zero-inflation component.

Zero Inflation and Missing Data

A zero should not automatically be assigned when the event assessment is missing.

For example:

  • zero events observed during complete follow-up is a legitimate zero;
  • unknown event status because the patient withdrew is not necessarily zero.

Converting missing outcomes into zeros can artificially inflate the apparent zero frequency and potentially create spurious evidence for zero inflation.

Never confuse missing with zero. The analysis dataset should preserve the distinction between a confirmed absence of events and an unavailable assessment.

Interpretation of Treatment Effects

Suppose treatment affects both model components. For example:

\[ e^{\beta_1}=0.75 \]

and:

\[ e^{\gamma_1}=1.50 \]

These estimates imply two different effects.

The treatment is associated with a 25% lower conditional event rate in the count component. At the same time, treatment is associated with 50% higher odds of membership in the structural-zero component.

The overall population-level effect is not obtained simply by multiplying 0.75 by 1.50.

Instead, the unconditional expected count must be calculated using:

\[ E(Y\mid X) = [1-\pi(X)]\mu(X) \]

for each treatment scenario.

Population-Level Predictions Are Often Best

For clinical interpretation, predicted means or predicted event probabilities can be easier to communicate than two sets of regression coefficients.

For example, a report might state:

Group Predicted Probability of Zero Predicted Mean Count
Control 68% 0.71
Treatment 76% 0.49

This directly addresses the clinical population rather than requiring readers to reconstruct the implications of the two model components.

Model-Based Prediction of the Entire Count Distribution

One advantage of a fitted count model is that it can predict the probability of:

  • zero events,
  • one event,
  • two events,
  • three events,
  • and larger event counts.

For ZIP:

\[ P(Y=0) = \pi+(1-\pi)e^{-\mu} \]

and for positive counts:

\[ P(Y=y) = (1-\pi) \frac{e^{-\mu}\mu^y}{y!}, \qquad y>0 \]

This allows direct comparison between the observed and model-predicted frequency distribution.

Checking Large Counts

Excess zeros are not the only possible problem. A model can fit zeros well while systematically underpredicting patients with very large event counts.

For example, if the observed data contain:

  • many zeros,
  • many ones,
  • and a small number of patients with 15–20 events,

a model may need additional heterogeneity or a different count distribution to reproduce the upper tail.

This is one reason ZINB may outperform ZIP even after zero inflation is included.

Influential Observations

Clinical count datasets can contain a small number of patients with extremely large event counts.

Those observations may have substantial influence on:

  • the estimated count mean,
  • the dispersion parameter,
  • regression coefficients,
  • and predicted event rates.

Influence diagnostics and sensitivity analyses should therefore be considered when extreme counts are present.

Model Convergence

Zero-inflated models can be more difficult to fit than ordinary generalized linear models.

Warning signs include:

  • non-convergence,
  • very large standard errors,
  • extreme coefficient estimates,
  • predicted zero probabilities near 0 or 1,
  • dispersion estimates near problematic boundaries,
  • or highly unstable estimates under small changes in model specification.
Do not ignore convergence warnings. A model that produces a coefficient table despite numerical instability should not automatically be considered successfully fitted.

Reducing Model Complexity

If a zero-inflated model is unstable, one potential solution is to simplify the model.

For example, rather than:

ziformula = ~ treatment + age + severity + sex +
  baseline_score + site + region

a prespecified clinically motivated model might use:

ziformula = ~ treatment + baseline_score

Overly complex mixture models can be difficult to estimate, particularly when the sample size is modest.

Sample Size Considerations

Sample-size planning for zero-inflated models can be more complicated than ordinary Poisson regression.

Important factors include:

  • Expected proportion of structural zeros
  • Mean count among the non-structural-zero population
  • Dispersion
  • Number and strength of covariate effects
  • Follow-up duration
  • Allocation ratio
  • Target estimand

Simulation is often preferable when the design is complex.

Simulation-Based Sample Size Planning

A practical approach is:

1
Specify plausible zero-inflation probabilities.
2
Specify plausible count means and dispersion.
3
Specify treatment effects for both components.
4
Generate simulated datasets under the proposed design.
5
Fit the planned analysis model to each simulated dataset.
6
Calculate statistical power and estimation performance.
7
Repeat across plausible parameter scenarios.

Clinical Trial Reporting

A zero-inflated model should be described sufficiently clearly that readers understand its structure.

A statistical analysis report should identify:

  • The clinical count endpoint
  • The observation period
  • How exposure time was handled
  • The count distribution
  • The zero-inflation specification
  • The covariates in each component
  • The link functions
  • The treatment effect estimand
  • The method of estimation
  • How confidence intervals were calculated
  • Model diagnostics
  • Model-selection criteria
  • Sensitivity analyses

Example Statistical Methods Language

A clinical trial statistical analysis plan might describe the model along the following lines:

Example: The number of disease exacerbations during the treatment period will be analyzed using a zero-inflated negative binomial regression model. The conditional count component will use a log link and include treatment group and prespecified baseline covariates. The zero-inflation component will use a logit link and include prespecified covariates associated with structural zero membership. Follow-up duration will be incorporated using the logarithm of exposure time as an offset. Treatment effects from the conditional component will be reported as incidence rate ratios with 95% confidence intervals, and model-based marginal mean event counts will be presented to facilitate clinical interpretation.

Common Mistakes

  1. Assuming excess zeros automatically imply zero inflation. A negative binomial model may adequately explain the data without a separate zero-generating process.
  2. Calling every observed zero a structural zero. Structural-zero status is generally latent.
  3. Ignoring overdispersion. ZIP is not necessarily appropriate if the count component is strongly overdispersed.
  4. Interpreting the zero-inflation coefficient as the probability of zero. The coefficient describes the log-odds of membership in the zero-inflation component.
  5. Interpreting the count coefficient as an unconditional treatment effect. The count coefficient describes the conditional count-generating component.
  6. Ignoring follow-up time. Patients with different exposure times have different opportunities to experience events.
  7. Converting missing outcomes to zero. Missing is not equivalent to no event.
  8. Using too many predictors. The two-component structure can become unstable with unnecessary complexity.
  9. Ignoring convergence warnings. Numerical convergence is an essential part of model validity.
  10. Reporting only AIC. Clinical plausibility, diagnostics, and predictive performance should also be considered.
  11. Ignoring large positive counts. A model can fit the zeros well while failing badly in the upper tail.
  12. Automatically choosing ZINB because it is more flexible. Additional flexibility should be justified by the data and scientific objective.

ZIP Versus ZINB: Practical Decision Framework

Observation Potential Model
Mean approximately equals variance; no excess zeros Poisson
Variance substantially exceeds mean Negative binomial
Strong clinical rationale for structural zeros; Poisson count component adequate ZIP
Structural zeros plus substantial count overdispersion ZINB
Scientific question is zero vs. positive, followed by positive count Hurdle model may be appropriate
Exact event timing is important Consider recurrent-event survival methods

A Complete R Analysis Workflow

library(glmmTMB)

# Poisson
m_pois <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  family = poisson,
  data = dat
)

# Negative binomial
m_nb <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  family = nbinom2,
  data = dat
)

# Zero-inflated Poisson
m_zip <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  ziformula = ~ treatment + severity,
  family = poisson,
  data = dat
)

# Zero-inflated negative binomial
m_zinb <- glmmTMB(
  exacerbations ~ treatment + age + severity +
    offset(log(followup)),
  ziformula = ~ treatment + severity,
  family = nbinom2,
  data = dat
)

# Compare information criteria
AIC(m_pois, m_nb, m_zip, m_zinb)

BIC(m_pois, m_nb, m_zip, m_zinb)

# Inspect final model
summary(m_zinb)

Extracting the Two Sets of Effects

# Conditional/count component
fixef(m_zinb)$cond

# Zero-inflation component
fixef(m_zinb)$zi

# Dispersion component
fixef(m_zinb)$disp

For the count component:

exp(fixef(m_zinb)$cond)

For the zero-inflation component:

exp(fixef(m_zinb)$zi)

The first set represents multiplicative effects on the conditional count scale, while the second represents odds ratios for the zero-inflation component.

Predicted Marginal Means

Estimated marginal means or model-based predictions can provide a more clinically accessible summary.

For example, predicted outcomes can be generated for representative treatment groups:

newdat <- expand.grid(
  treatment = levels(dat$treatment),
  age = mean(dat$age, na.rm = TRUE),
  severity = mean(dat$severity, na.rm = TRUE),
  followup = 1
)

newdat$predicted_count <- predict(
  m_zinb,
  newdata = newdat,
  type = "response"
)

newdat

The resulting predictions incorporate both the zero-inflation probability and the count-generating process.

Interpreting a Hypothetical Result

Suppose the final ZINB model produces:

Parameter Estimate Exponentiated Effect
Count component: treatment -0.288 IRR = 0.75
Zero-inflation component: treatment 0.405 OR = 1.50

The count component suggests that, among patients in the count-generating population, treatment is associated with approximately 25% fewer events.

The zero-inflation component suggests that treatment is associated with higher odds of belonging to the structural-zero state.

The overall treatment effect should then be communicated using predicted marginal counts or other prespecified estimands.

Why the Two Effects Can Work in the Same Direction

Treatment could reduce event frequency in two ways:

  • It could increase the proportion of patients who have no events at all.
  • It could reduce the number of events among patients who remain in the count-generating population.

A zero-inflated model can represent both mechanisms simultaneously.

This can be clinically informative when those mechanisms have distinct interpretations.

But the Structural-Zero Interpretation Requires Caution

A statistical mixture does not necessarily correspond to a literal biological subpopulation.

For example, patients may have continuously varying susceptibility rather than belonging to two genuinely discrete groups.

A zero-inflated model may nevertheless provide a useful approximation to that heterogeneity.

Model language matters: It is safer to say that the model contains a "zero-inflation component" than to claim that the study has definitively identified a biologically distinct population of "immune" or "non-susceptible" patients.

Sensitivity Analyses

A robust clinical analysis should consider sensitivity to model specification.

Potential sensitivity analyses include:

  • Poisson versus negative binomial
  • ZIP versus ZINB
  • Alternative zero-inflation covariates
  • Alternative exposure definitions
  • Alternative follow-up windows
  • Influential observations
  • Alternative handling of extreme counts
  • Alternative clinically justified estimands

What If the Zero-Inflation Component Is Unstable?

If the estimated zero-inflation probability is extremely close to zero or one, the model may be trying to separate the data into components that are not adequately identifiable.

For example, if nearly every patient has a high probability of structural-zero membership, there may not be enough positive counts to estimate the count component reliably.

Potential responses include:

  • simplifying the zero-inflation model,
  • reducing unnecessary covariates,
  • checking the clinical definition of the endpoint,
  • examining follow-up and exposure,
  • comparing with a negative binomial model,
  • or reconsidering whether a zero-inflated model is scientifically justified.

Do Not Automatically Transform Counts

A common approach to skewed outcomes is to transform them. For count outcomes, however, taking:

\[ \log(Y) \]

creates an immediate problem when: \(Y=0\).

Adding an arbitrary constant such as one:

\[ \log(Y+1) \]

changes the interpretation of the outcome and generally does not solve the underlying count-data problem.

A count regression model is usually preferable when the outcome genuinely represents event counts.

Zero-Inflated Models and Multiplicity

If multiple outcomes or multiple model components are examined, the inferential strategy should be prespecified.

For example, a study might report:

  • the count-component treatment effect,
  • the zero-inflation treatment effect,
  • the unconditional mean difference,
  • and several secondary outcomes.

Not all of these necessarily represent separate confirmatory hypotheses. The statistical analysis plan should define which estimand is primary.

Choose the Estimand Before Choosing the Model

A particularly important principle is: the model should serve the scientific estimand.

Possible estimands include:

  • Conditional event rate among the count-generating population
  • Probability of belonging to the structural-zero component
  • Overall mean number of events
  • Difference in mean event counts
  • Rate ratio
  • Difference in probability of at least one event

Different estimands can lead to different preferred summaries even when the same fitted model is used.

Probability of At Least One Event

For a ZIP model:

\[ P(Y>0) = 1- \left[ \pi+(1-\pi)e^{-\mu} \right] \]

Therefore:

\[ P(Y>0) = (1-\pi)(1-e^{-\mu}) \]

This probability can be especially clinically useful.

It combines the zero-inflation and count components into the probability that a patient experiences at least one event.

Example

Suppose:

\[ \pi=0.40 \qquad \mu=1.2 \]

Then:

\[ P(Y>0) = 0.60(1-e^{-1.2}) \]

which is approximately:

\[ P(Y>0)\approx0.419 \]

Thus approximately 41.9% of the overall population is expected to experience at least one event.

Clinical Interpretation of the Worked Example

Suppose a treatment changes the model from:

\[ \pi_C=0.30,\qquad\mu_C=1.4 \]

in control to:

\[ \pi_T=0.45,\qquad\mu_T=1.0 \]

in treatment.

The control-group unconditional mean is:

\[ E(Y_C) = (1-0.30)(1.4) = 0.98 \]

The treatment-group unconditional mean is:

\[ E(Y_T) = (1-0.45)(1.0) = 0.55 \]

Thus the treatment reduces the overall expected number of events from approximately 0.98 to 0.55 per patient over the specified observation period.

This marginal comparison may be more clinically intuitive than interpreting the two model coefficients independently.

Modeling Strategy for a Clinical Trial

1
Define the clinical event count precisely.
2
Define the observation period and exposure time.
3
Specify the primary estimand.
4
Inspect the empirical count distribution.
5
Assess whether a negative binomial model is required.
6
Determine whether a separate structural-zero mechanism is scientifically plausible.
7
Specify the count and zero-inflation covariates.
8
Fit candidate models.
9
Compare model fit and diagnostics.
10
Generate clinically interpretable marginal predictions.
11
Perform prespecified sensitivity analyses.
12
Report both model specification and clinically meaningful estimands.

What Should Be Reported?

A reproducible report should provide enough information to reconstruct the analysis.

At minimum, report:

  • Definition of the count outcome
  • Observation period
  • Exposure-time definition
  • Count distribution
  • Reason for considering zero inflation
  • Zero-inflation model specification
  • Count model specification
  • Covariates in each component
  • Link functions
  • Offset, if applicable
  • Estimation method
  • Dispersion parameterization
  • Effect measures
  • Confidence intervals
  • Model diagnostics
  • Model-selection criteria
  • Sensitivity analyses

Example Results Table

Effect Estimate 95% CI Interpretation
Conditional treatment effect IRR = 0.75 0.61–0.92 25% lower event rate in the count component
Zero-inflation treatment effect OR = 1.50 1.10–2.05 Higher odds of structural-zero membership
Marginal mean count 0.55 vs. 0.98 — Lower overall predicted event frequency

This style of reporting prevents the two components from being conflated.

Avoid Overinterpreting Latent Membership

Suppose a patient has a posterior probability of structural-zero membership of 0.85.

It would be inappropriate to conclude that the patient is definitively a structural zero.

The model says that, conditional on the observed data and fitted model, the patient has an estimated probability of 85% of belonging to that latent component.

The remaining 15% probability corresponds to the possibility that the observed zero arose from the ordinary count process.

Zero-Inflated Models Are Mixture Models

The most useful mental model is:

A
Latent process: Is the patient in the structural-zero state?
B
Count process: If not, how many events occur?
C
Observed outcome: the mixture produces the final count.

The Most Important Concept

The most important concept in zero-inflated modeling is that not all zeros have to come from the same mechanism.

An ordinary Poisson or negative binomial model assumes that all observations come from one count-generating process.

A zero-inflated model adds a second process that generates structural zeros.

For ZIP:

\[ P(Y=0) = \pi+(1-\pi)e^{-\mu} \]

while:

\[ P(Y=y>0) = (1-\pi) \frac{e^{-\mu}\mu^y}{y!} \]

The expected count is:

\[ E(Y) = (1-\pi)\mu \]

Those three equations capture the basic structure of the ZIP model.

Bottom Line

Bottom line: Zero-inflated models are useful for clinical count outcomes when there is evidence and scientific justification for a separate process generating structural zeros. A zero-inflated Poisson model combines a logistic zero-inflation component with a Poisson count component, while a zero-inflated negative binomial model additionally allows overdispersion in the count component. The two components have different interpretations and should be reported separately. In clinical trials, exposure time, missing outcomes, recurrent-event structure, model convergence, and the distinction between conditional and unconditional treatment effects are especially important. ZIP or ZINB should not be selected solely because a dataset contains many zeros; Poisson, negative binomial, zero-inflated, and hurdle models should be considered in the context of the scientific estimand and the underlying clinical data-generating process.

References

Lambert, D. (1992). Zero-inflated Poisson regression, with an application to defects in manufacturing. Technometrics, 34(1), 1–14.

Cameron, A.C. & Trivedi, P.K. (2010). Microeconometrics Using Stata. Stata Press.

Hilbe, J.M. (2011). Negative Binomial Regression. Cambridge University Press.

Zeileis, A., Kleiber, C. & Jackman, S. (2008). Regression models for count data in R. Journal of Statistical Software, 27(8).

Brooks, M.E., Kristensen, K., van Benthem, K.J., Magnusson, A., Berg, C.W., Nielsen, A., Skaug, H.J., Mächler, M. & Bolker, B.M. (2017). glmmTMB balances speed and flexibility among packages for zero-inflated generalized linear mixed modeling. The R Journal, 9(2), 378–400.

Heinze, G., Wallisch, C. & Dunkler, D. (2018). Variable selection – A review and recommendations for the practicing statistician. Biometrical Journal, 60(3), 431–449.