Tutorials › Generalized Linear Mixed Models (GLMM) › The Marginal Mean of a Zero-Inflated Count

Overdispersion and Zero Inflation · Tutorial 545 of 698

The Marginal Mean of a Zero-Inflated Count

Learn to calculate and interpret fitted marginal means for zero-inflated counts without confusing them with component means or probabilities of a positive count.

Advanced 10 min read

What You'll Learn

  • Define the structural-zero probability and the count-component mean in a zero-inflated model.
  • Derive the observed-count mean using conditional expectation.
  • Calculate fitted marginal means from log-link and logit-link predictors.
  • Distinguish the marginal mean from the component mean and the probability of a positive count.
  • Average unit-specific predictions correctly when covariate patterns differ.
  • Recognize common prediction and calibration pitfalls for zero-inflated counts.

Why the Count-Component Mean Is Not the Observed Mean

A zero-inflated count model describes two ways an observed count can arise. An observation may belong to a structural-zero class, in which case its count is zero; otherwise, its count follows a specified count distribution. Consequently, the mean of that count distribution is not generally the mean of the observed counts. Some observations are set to zero before the count component can contribute anything.

The distinction matters when reporting expected counts in context. A count-component mean might describe the expected number of events among observations in the count-generating class. The marginal mean describes the expected number across all observations at the specified covariate values, including structural zeros. This tutorial derives that marginal mean and shows how to calculate it from fitted model values.

Definition: For observation \(i\), let \(\pi_i\) be the probability of belonging to the structural-zero class. With probability \(1-\pi_i\), the observation belongs to the count-generating class, where the count has mean \(\mu_i\). A structural-zero observation has count \(Y_i=0\). The marginal mean is \(E(Y_i)\), averaging over both latent classes.

For a zero-inflated Poisson model, the count-generating distribution is Poisson. One common predictor specification is

$$ \log(\mu_i)=x_i^{T}\beta, \qquad \operatorname{logit}(\pi_i)=z_i^{T}\gamma, \qquad \operatorname{logit}(\pi_i)=\log\left(\frac{\pi_i}{1-\pi_i}\right). $$

Here \(x_i\) and \(z_i\) are the covariate vectors for the count and zero-inflation components, respectively; \(\beta\) and \(\gamma\) are their coefficient vectors. The predictors need not use the same covariates. The marginal-mean calculation below applies to any count-generating distribution with finite mean \(\mu_i\), not only the Poisson distribution. In the examples, fitted values are evaluated at specified covariates; no averaging over random effects is involved.

Deriving the Marginal Mean

The defining mixture assumptions are that a structural-zero observation has count zero, and that the count-generating class has conditional mean \(\mu_i\). The probability of the latter class is \(1-\pi_i\). Apply the law of total expectation, conditioning on class membership:

$$ \begin{aligned} E(Y_i) &=E(Y_i\mid\text{structural zero})P(\text{structural zero})\\ &\quad+E(Y_i\mid\text{count-generating class}) P(\text{count-generating class})\\ &=0\cdot\pi_i+\mu_i(1-\pi_i)\\ &=(1-\pi_i)\mu_i. \end{aligned} $$

This argument does not require the count-generating distribution to be Poisson: it uses only its mean. It does require the mixture interpretation stated above. In particular, \(\pi_i\) is the probability of structural-zero class membership, not the probability that the observed count equals zero. A count-generating observation can itself have a sampling zero.

Key result: At fixed covariate values, the fitted marginal mean of a zero-inflated count is the fitted probability of belonging to the count-generating class multiplied by the fitted mean in that class: \(\widehat{E(Y_i)}=(1-\hat{\pi}_i)\hat{\mu}_i\).

For the log-link and logit-link predictors above, the response-scale calculation is

$$ \widehat{E(Y_i)} = \left[ 1-\frac{\exp(z_i^{T}\hat{\gamma})} {1+\exp(z_i^{T}\hat{\gamma})} \right]\exp(x_i^{T}\hat{\beta}). $$

The predictor values must first be converted to probabilities and means on their respective response scales. Multiplying a linear predictor by another fitted quantity, or multiplying the count mean by \(\hat{\pi}_i\), does not give the marginal mean.

Worked Example: A Fitted Mean at One Covariate Pattern

Suppose a fitted zero-inflated Poisson model gives \(\hat{\mu}_i=4.2\) events per observation period and \(\hat{\pi}_i=0.30\) for a specified covariate pattern. Calculate and interpret the marginal mean.

The fitted probability of belonging to the count-generating class is \(1-\hat{\pi}_i=1-0.30=0.70\). Therefore,

$$ \widehat{E(Y_i)} =(1-\hat{\pi}_i)\hat{\mu}_i =(1-0.30)(4.2) =0.70(4.2) =2.94. $$

At this covariate pattern, the model predicts an average of 2.94 events per observation period across the mixture of classes. The value 4.2 is instead the mean for the count-generating class. It is not the expected count across all observations represented by this prediction.

Calculating from Linear Predictors

Model software may provide fitted linear predictors rather than fitted component means and probabilities. For a log link, exponentiating the count predictor gives \(\hat{\mu}_i\). For a logit link, applying the inverse-logit function gives \(\hat{\pi}_i\). The marginal mean is then calculated from those two response-scale values.

Worked Example: Converting Predictors to a Marginal Mean

For a hypothetical observation, suppose the fitted count linear predictor is \(x_i^T\hat{\beta}=1.2528\), and the fitted zero-inflation linear predictor is \(z_i^T\hat{\gamma}=-1.0986\). Both predictors are evaluated at the same specified covariate pattern. Find the fitted marginal mean.

First convert the count predictor using the log link:

$$ \hat{\mu}_i=\exp(1.2528)\approx 3.500. $$

Next convert the zero-inflation predictor using the inverse logit:

$$ \hat{\pi}_i =\frac{\exp(-1.0986)}{1+\exp(-1.0986)} \approx \frac{0.3333}{1.3333} =0.2500. $$

Thus, the fitted probability of belonging to the count-generating class is \(1-0.2500=0.7500\), and

$$ \widehat{E(Y_i)} =(0.7500)(3.500) =2.625. $$

The fitted marginal mean is 2.625 counts per observation at this covariate pattern. The value 0.2500 is a fitted structural-zero probability, not the probability of observing any zero.

Comparing Predictions Across Covariate Patterns

The marginal mean combines information from both model components. A difference in predicted marginal means can reflect a change in the count-component mean, a change in the structural-zero probability, or changes in both. It is therefore important to calculate the product for each covariate pattern before comparing predictions.

Worked Example: Component Means and Marginal Means Can Tell Different Stories

Consider two hypothetical groups observed for the same length of time. For group A, suppose the fitted values are \(\hat{\mu}_A=2.0\) counts and \(\hat{\pi}_A=0.10\). For group B, suppose they are \(\hat{\mu}_B=4.0\) counts and \(\hat{\pi}_B=0.40\). Calculate both marginal means and compare them.

For group A:

$$ \widehat{E(Y_A)} =(1-0.10)(2.0) =0.90(2.0) =1.80\text{ counts}. $$

For group B:

$$ \widehat{E(Y_B)} =(1-0.40)(4.0) =0.60(4.0) =2.40\text{ counts}. $$

The count-component mean for B is twice the count-component mean for A, but the marginal mean for B is \(2.40/1.80=1.333\) times the marginal mean for A. The larger structural-zero probability in B reduces the difference between the component means and the observed-count means. These are model-based predicted averages, not evidence that group membership causes a change in counts.

When predictions are needed for multiple observations, calculate the marginal mean separately at each observation’s covariates. If the target is the expected total across \(n\) observations, add their fitted marginal means. If the target is the average expected count across those observations, average the fitted marginal means.

Worked Example: Averaging Predictions with Different Covariates

Suppose two hypothetical observations have fitted values \((\hat{\mu}_1,\hat{\pi}_1)=(2.0,0.10)\) and \((\hat{\mu}_2,\hat{\pi}_2)=(6.0,0.50)\). Find the average fitted marginal mean for these two observations, and compare it with multiplying the average component mean by one minus the average structural-zero probability.

Calculate each marginal mean first:

$$ \widehat{E(Y_1)}=(1-0.10)(2.0)=1.80, \qquad \widehat{E(Y_2)}=(1-0.50)(6.0)=3.00. $$

Their average fitted marginal mean is

$$ \frac{1.80+3.00}{2}=2.40\text{ counts per observation}. $$

The average component mean is \((2.0+6.0)/2=4.0\), and the average structural-zero probability is \((0.10+0.50)/2=0.30\). Multiplying these averages gives

$$ (1-0.30)(4.0)=0.70(4.0)=2.80, $$

which is not the average fitted marginal mean of 2.40. The multiplication must be done for each observation before averaging, because the product of averages need not equal the average of the products. For these two observations, the expected total count is \(1.80+3.00=4.80\).

Distinctions, Diagnostics, and Limitations

Three quantities are easy to confuse: the count-component mean \(\mu_i\), the marginal mean \((1-\pi_i)\mu_i\), and the probability of a positive observed count. In a zero-inflated Poisson model, the last quantity is

$$ P(Y_i>0)=(1-\pi_i)P\{\operatorname{Poisson}(\mu_i)>0\} =(1-\pi_i)(1-\exp(-\mu_i)). $$

For example, if \(\pi_i=0.25\) and \(\mu_i=2\), the marginal mean is \(0.75(2)=1.50\) counts, while the probability of a positive count is \(0.75(1-\exp(-2))\approx0.6485\). A mean is measured in counts; a probability is dimensionless. They answer different questions.

A useful prediction check is to compare fitted marginal means with observed average counts across groups defined by relevant covariate patterns. Also check the model’s predicted zero frequencies against observed zero frequencies: agreement in the overall mean alone does not ensure that zeros are well represented. For a zero-inflated Poisson model, the model-implied zero probability is

$$ P(Y_i=0)=\pi_i+(1-\pi_i)\exp(-\mu_i), $$

because an observed zero can arise from either class. Persistent discrepancies in means or zero frequencies can indicate that the specified predictors or count distribution do not adequately describe the data. Convergence problems or fitted probabilities near zero or one also call for careful review; they do not by themselves establish that the mixture interpretation is appropriate.

An ordinary Poisson GLM specifies a single Poisson mean rather than this two-class mixture. It can provide a different distributional description even when its predicted mean is similar. Conversely, matching the observed average with a zero-inflated model does not demonstrate that the data contain a distinct structural-zero class. The marginal-mean formula is a consequence of the assumed mixture, not a test that validates the assumption.

Common pitfall: Multiplying \(\hat{\mu}_i\) by \(\hat{\pi}_i\), or treating \(\hat{\pi}_i\) as the probability of any observed zero, gives the wrong interpretation. The structural-zero class contributes zero counts, so the marginal mean is \((1-\hat{\pi}_i)\hat{\mu}_i\). Sampling zeros from the count-generating distribution are already part of that component.

The calculation gives a fitted mean at specified covariates under the stated mixture model. It is not an individual-level prediction that the next observation will equal that mean, and it does not quantify uncertainty in the estimated mean. In models with additional sources of variation, predictions may require further averaging; the product derived here applies at the level where \(\pi_i\) and \(\mu_i\) are specified.

Check Your Understanding

Work through each question, then compare your reasoning with the solutions.

  1. A fitted model gives \(\hat{\pi}=0.20\) and \(\hat{\mu}=5.0\) counts per day. What is the fitted marginal mean per day?
  2. For a zero-inflated Poisson model with \(\pi=0.40\) and \(\mu=1.5\), calculate the probability of a positive count. Explain why it differs from the marginal mean.
  3. Two observations have fitted marginal means of 1.2 and 3.6 counts. What is their expected total count, and what is their average fitted marginal mean?
  4. Explain why multiplying the average fitted count-component mean by one minus the average fitted structural-zero probability need not give the average marginal mean.

Solutions. (1) \((1-0.20)(5.0)=0.80(5.0)=4.0\) counts per day. (2) \(P(Y>0)=(1-0.40)(1-\exp(-1.5))=0.60(0.7769)\approx0.4661\). This is a probability; the marginal mean is \(0.60(1.5)=0.90\) counts. (3) The expected total is \(1.2+3.6=4.8\) counts, and the average fitted marginal mean is \(4.8/2=2.4\) counts per observation. (4) In general, each product uses paired values, and the average of products need not equal the product of averages; calculate \((1-\hat{\pi}_i)\hat{\mu}_i\) for each observation before averaging.

Clinical Biostats