Tutorials › Generalized Linear Mixed Models (GLMM) › Mean and Variance of a Hurdle Count

Overdispersion and Zero Inflation · Tutorial 558 of 698

Mean and Variance of a Hurdle Count

Learn to derive hurdle-count moments, calculate them from a zero-truncated distribution, and distinguish conditional moments from marginal moments when random effects are present.

Advanced 9 min read

What You'll Learn

  • Derive the hurdle-count mean and variance using an indicator for crossing the hurdle.
  • Calculate positive-count moments from a zero-truncated baseline distribution.
  • Separate the contribution of positive-count variability from variation between zero and positive outcomes.
  • Marginalize conditional hurdle moments over random effects.
  • Check edge cases and diagnose mismatches between observed and model-implied moments.

Why the Hurdle Mean and Variance Need Two Pieces

A hurdle count is zero when an observation does not cross a hurdle and is positive when it does. Among positive observations, counts follow a positive-valued distribution. These two parts determine the overall mean and variance: the chance of a positive count controls how often counts contribute, while the conditional distribution describes their sizes once positive.

This separation matters when interpreting model predictions. A low overall mean could reflect rare positive outcomes, small counts among positive outcomes, or both. Likewise, overall variability includes variation among positive counts and variation between zero and positive outcomes. The formulas below make those contributions explicit.

Definition: Let \(Y\) be a nonnegative integer-valued hurdle count, and define \(A=I(Y>0)\), where \(I(\cdot)\) equals 1 when its condition is true and 0 otherwise. Write \(q=P(Y>0)\), \(m_+=E(Y\mid Y>0)\), and \(v_+=\operatorname{Var}(Y\mid Y>0)\). The hurdle distribution has \(P(Y=0)=1-q\), and its positive counts have the specified conditional distribution of \(Y\mid Y>0\). Assume \(0<q\leq 1\) and that the positive distribution has a finite second moment.

The positive-count distribution can be specified directly on \(1,2,\ldots\), or obtained by taking a baseline count distribution and conditioning it to be positive. In either case, \(q\) is the hurdle-crossing probability; it need not equal the baseline distribution’s probability of being positive.

Deriving the Overall Moments

Because \(Y=0\) when \(A=0\), and \(Y\) has conditional mean \(m_+\) when \(A=1\), its conditional expectation given \(A\) is \(E(Y\mid A)=A m_+\). Taking expectations gives the overall mean:

$$ E(Y)=E\{E(Y\mid A)\}=E(A m_+)=q m_+. $$

For the variance, use the law of total variance: \(\operatorname{Var}(Y)=E\{\operatorname{Var}(Y\mid A)\}+\operatorname{Var}\{E(Y\mid A)\}\). When \(A=0\), the conditional variance is zero; when \(A=1\), it is \(v_+\). Thus the first term is \(qv_+\). The conditional mean is \(A m_+\), and \(A\) is Bernoulli with success probability \(q\), so the second term is \(m_+^2q(1-q)\). Therefore:

$$ E(Y)=q m_+,\qquad \operatorname{Var}(Y)=qv_+ + q(1-q)m_+^2. $$
Theorem: For a hurdle count with crossing probability \(q\), positive-count mean \(m_+\), and positive-count variance \(v_+\), the overall mean is \(q m_+\). The overall variance is \(qv_+ + q(1-q)m_+^2\). The first variance term is positive-count variability weighted by the probability of a positive count; the second is variability from switching between zero and a positive conditional mean.

An equivalent check starts with the second moment. Since \(Y^2=0\) at zero and \(E(Y^2\mid Y>0)=v_++m_+^2\),

$$ E(Y^2)=q(v_++m_+^2),\qquad \operatorname{Var}(Y)=E(Y^2)-\{E(Y)\}^2 =qv_+ + q(1-q)m_+^2. $$

The two derivations agree. The conditional-variance derivation highlights the components; the second-moment derivation is a useful arithmetic check.

Worked Example: Poisson Counts Truncated Above Zero

Hypothetical model. Suppose the positive-count distribution is a Poisson distribution with baseline rate \(\lambda=1.2\), conditioned on being positive, and the hurdle-crossing probability is \(q=0.40\). Find the overall mean and variance. The positive conditional moments must be calculated before applying the hurdle formulas.

For a Poisson random variable \(X\), \(P(X=0)=e^{-\lambda}\), \(E(X)=\lambda\), and \(E(X^2)=\lambda+\lambda^2\). Since \(X=0\) contributes nothing to either first or second raw moment, conditioning on \(X>0\) gives:

$$ P(X>0)=1-e^{-1.2}\approx0.6988058,\qquad m_+=\frac{1.2}{0.6988058}\approx1.717215. $$

The conditional second raw moment is:

$$ E(X^2\mid X>0)=\frac{1.2+1.2^2}{0.6988058} =\frac{2.64}{0.6988058}\approx3.777874. $$

Subtract the square of the conditional mean to obtain the conditional variance. Keeping sufficient digits in the arithmetic gives:

$$ v_+\approx3.7778736882-(1.7172153128)^2 =3.7778736882-2.9488284306\approx0.8290452576\approx0.829045. $$

Now apply the hurdle formulas. The overall mean is \(0.40(1.717215)\approx0.686886\) counts. For the variance, the two contributions are \(0.40(0.8290452576)\approx0.331618\) counts squared and \(0.40(0.60)(2.9488284306)\approx0.707719\) counts squared. Their sum is approximately \(1.039337\) counts squared. The hurdle model’s positive probability is \(0.40\), distinct from the baseline Poisson probability \(0.6988058\) of a positive value.

Calculating Positive Moments From a Baseline Distribution

For a baseline count variable \(X\) with mean \(\mu_0\), variance \(\sigma_0^2\), and zero probability \(\pi_0=P(X=0)<1\), the distribution conditioned on \(X>0\) has:

$$ E(X\mid X>0)=\frac{\mu_0}{1-\pi_0},\qquad E(X^2\mid X>0)=\frac{\sigma_0^2+\mu_0^2}{1-\pi_0}. $$

The denominators are the probability of retaining a baseline draw after restricting to positive values. The numerators are unchanged by removing zeros because a zero contributes zero to both \(X\) and \(X^2\). Subtracting the squared conditional mean from the conditional second raw moment yields the conditional variance. This is the calculation used in the Poisson example; it also applies whenever the baseline distribution has the stated moments.

Worked Example: Applying the Formula to Given Conditional Moments

Hypothetical model. Suppose the chance of a positive count is \(q=0.65\). Among positive outcomes, the mean is \(m_+=2.4\) claims and the variance is \(v_+=3.1\) claims squared. Calculate the overall mean and variance.

The overall mean is the crossing probability multiplied by the positive conditional mean:

$$ E(Y)=0.65(2.4)=1.56\text{ claims}. $$

For the variance, the within-positive contribution is \(0.65(3.1)=2.015\) claims squared. The zero-versus-positive contribution is \(0.65(1-0.65)(2.4)^2=0.65(0.35)(5.76)=1.3104\) claims squared. Therefore:

$$ \operatorname{Var}(Y)=2.015+1.3104=3.3254\text{ claims squared}. $$

This calculation does not require knowing how \(q\), \(m_+\), or \(v_+\) were modeled. It requires only that they refer to the same hurdle distribution and conditioning context.

Worked Example: Checking the Formula From a Positive Probability Table

Hypothetical model. Let \(q=0.30\), and suppose a positive count equals 1, 2, or 4 with conditional probabilities \(0.50\), \(0.30\), and \(0.20\), respectively. Find the positive conditional moments and then the overall moments.

The conditional mean among positive outcomes is \(m_+=1(0.50)+2(0.30)+4(0.20)=1.90\) counts. The conditional second raw moment is \(E(Y^2\mid Y>0)=1^2(0.50)+2^2(0.30)+4^2(0.20)=4.90\) counts squared. Hence \(v_+=4.90-(1.90)^2=1.29\) counts squared.

The overall mean is \(0.30(1.90)=0.57\) counts. The variance is:

$$ 0.30(1.29)+0.30(0.70)(1.90)^2 =0.387+0.7581=1.1451\text{ counts squared}. $$

As an independent check, \(E(Y^2)=0.30(4.90)=1.47\) counts squared, so \(\operatorname{Var}(Y)=1.47-(0.57)^2=1.1451\) counts squared. Agreement confirms both the conditional-moment calculation and the hurdle variance formula.

Conditional and Marginal Moments With Random Effects

In a mixed model, hurdle parameters may depend on covariates and a random effect. The formulas first give moments conditional on those quantities. If \(B\) denotes a random effect, write \(q(B)\), \(m_+(B)\), and \(v_+(B)\) for the corresponding conditional parameters. Then:

$$ E(Y\mid B)=q(B)m_+(B),\qquad \operatorname{Var}(Y\mid B)=q(B)v_+(B)+q(B)\{1-q(B)\}m_+(B)^2. $$

To obtain marginal moments, average the conditional variance and add the variance of the conditional mean. This is the law of total variance, not a license to substitute average parameters into the conditional formula:

$$ E(Y)=E\{q(B)m_+(B)\}, $$ $$ \operatorname{Var}(Y)=E\!\left[q(B)v_+(B)+q(B)\{1-q(B)\}m_+(B)^2\right] +\operatorname{Var}\{q(B)m_+(B)\}. $$

Worked Example: Marginalizing Over Two Random-Effect Settings

Hypothetical model. Suppose two random-effect settings are equally likely. In setting 1, \(q=0.20\), \(m_+=1\), and \(v_+=1\); in setting 2, \(q=0.80\), \(m_+=2\), and \(v_+=2\). Calculate the marginal mean and variance.

The conditional means are \(0.20(1)=0.20\) and \(0.80(2)=1.60\) counts. Their average is \(E(Y)=(0.20+1.60)/2=0.90\) counts. The conditional variances are \(0.20(1)+0.20(0.80)(1)^2=0.36\) and \(0.80(2)+0.80(0.20)(2)^2=2.24\) counts squared. Their average is \(1.30\) counts squared.

The conditional means vary across settings. Their variance is \(\{(0.20-0.90)^2+(1.60-0.90)^2\}/2=0.49\) counts squared. Thus the marginal variance is \(1.30+0.49=1.79\) counts squared. Using only an averaged conditional variance would omit the \(0.49\) contribution from between-setting variation.

Assumptions, Diagnostics, and Common Errors

The moment identities require a well-defined hurdle probability and finite conditional moments. They do not require a Poisson positive-count distribution. When parameters vary with covariates, calculate moments at the same covariate values; for a marginal prediction, also average over the relevant random-effect distribution. These are algebraic identities, but using them for a fitted model’s interpretation depends on the model adequately describing the zero probability and positive counts.

Useful checks examine each part rather than only the overall mean. Compare the observed proportion of positive counts with the model-implied \(q\), and compare the distribution of positive counts with the model-implied conditional mean and variance. A discrepancy confined to positive counts points toward the positive-count component; a discrepancy in the frequency of zeros points toward the hurdle probability. In grouped or mixed data, distinguish conditional predictions from marginal predictions, since averaging over heterogeneity can change both moments.

A common mistake is to treat \(m_+\) as the overall mean, or to set the hurdle probability equal to the baseline distribution’s nonzero probability when the positive component is zero-truncated. The correction is to identify the conditioning explicitly: \(m_+=E(Y\mid Y>0)\), whereas \(E(Y)=q m_+\); and the hurdle probability \(q\) is specified separately from the truncation probability used to normalize the positive distribution.

Another error is to use \(qv_+\) as the entire variance. That omits \(q(1-q)m_+^2\), which is positive whenever \(0<q<1\) and \(m_+>0\). Conversely, with random effects, applying the conditional variance formula at averaged parameter values generally does not give the marginal variance. Average the conditional variance and add the variance of the conditional mean.

The moment formulas summarize a distribution but do not establish that its hurdle mechanism is appropriate, nor do they guarantee a good fit to the entire positive-count shape. A single mean and variance can conceal tail behavior or subgroups. Their role is to interpret the implied moments and to check calculations, alongside assessment of the model’s component distributions.

Check Your Understanding

Answer each question, then compare with the brief solutions below.

  1. If \(q=0.25\), \(m_+=3\), and \(v_+=4\), what are the overall mean and variance?
  2. For a zero-truncated baseline count distribution, why is the conditional mean divided by \(P(X>0)\)?
  3. What variance contribution is missing from the expression \(qv_+\)?
  4. Why can substituting average random-effect parameters into the conditional variance formula give the wrong marginal variance?
  5. If \(q=1\), what do the hurdle moment formulas reduce to?

Solutions. (1) \(E(Y)=0.25(3)=0.75\); \(\operatorname{Var}(Y)=0.25(4)+0.25(0.75)(9)=1+1.6875=2.6875\). (2) Conditioning retains only the fraction \(P(X>0)\) of baseline draws, while zero draws contribute nothing to the first moment; dividing by that retained probability renormalizes the positive values. (3) The missing term is \(q(1-q)m_+^2\), the variability between zero and positive outcomes. (4) The marginal variance is the average conditional variance plus the variance of the conditional mean; parameter averaging generally omits or changes those components. (5) The mean is \(m_+\) and the variance is \(v_+\), as all outcomes are positive and the zero-versus-positive contribution is zero.

Clinical Biostats