Why Repeated Counts Need a Joint Model
Repeated counts from the same subject are usually related. A subject who tends to have high counts at one visit may also tend to have high counts at another. A zero-inflated count model represents two sources of zeros at an observation: a latent zero state and a count-generating process that can itself produce zero. In repeated measures, a further question arises: what connects the observations from the same subject?
A subject-level random effect provides one answer. It shifts the count rate, the probability of belonging to the zero state, or both across all visits for that subject. Conditional on those shared effects, observations may be independent; after the effects are integrated out, the counts are generally dependent. This distinction is essential for forming a correct likelihood and interpreting joint probabilities.
Model and Assumptions
Let \(Y_{ij}\) be the count for subject \(i\) at visit \(j\), with \(i=1,\ldots,n\) and \(j=1,\ldots,m_i\). Define \(S_{ij}=1\) when observation \(ij\) is in the structural-zero state and \(S_{ij}=0\) when it is in the count-generating state. In the model below, conditional on the subject effects, these states are generated separately at each visit.
The covariance matrix \(\mathbf{D}\) may allow the count and zero-inflation random effects to be correlated. If their covariance is set to zero, the two random effects are independent under the bivariate normal assumption. A random intercept shared across visits represents persistent subject heterogeneity; it does not by itself specify a separate serial correlation that changes with the time gap between visits.
For a single observation, the conditional probability of zero is \(q_{ij}=\pi_{ij}+(1-\pi_{ij})\exp(-\mu_{ij})\). For \(y_{ij}>0\), its conditional probability is \((1-\pi_{ij})\exp(-\mu_{ij})\mu_{ij}^{y_{ij}}/y_{ij}!\). A negative binomial count-generating distribution can replace the Poisson distribution, but the shared-effects logic and the integration over those effects remain the same.
From Conditional Probabilities to a Subject Likelihood
Conditional independence means that the subject’s contribution is a product over visits once \(b_i,u_i\) are fixed. The population likelihood contribution is not generally that product evaluated at zero effects: it averages the product over the random-effects distribution. This integration is what carries the within-subject dependence into the joint distribution.
For a zero observation, the bracketed factor in this expression is shorthand for the full zero probability \(q_{ij}=\pi_{ij}+(1-\pi_{ij})f_{\mathrm{Pois}}(0;\mu_{ij})\), not merely \(\pi_{ij}\). Thus a fully explicit expression uses \(q_{ij}\) when \(y_{ij}=0\), and \((1-\pi_{ij})f_{\mathrm{Pois}}(y_{ij};\mu_{ij})\) when \(y_{ij}>0\). The random-effects density is denoted by \(\phi_2\).
A short covariance derivation makes the same point for counts. Conditional on the effects, visits are independent, so their conditional covariance is zero. The law of total covariance gives
The first term is zero by the conditional-independence assumption. The remaining covariance is induced by shared effects. With a common count random intercept and fixed zero probability, it is typically positive; when both components vary, its sign and magnitude depend on how the effects and covariates act together.
Worked Example: A Subject’s Conditional Joint Probability
Consider a hypothetical subject observed twice. Let the count intercept be \(\log(1.5)\), the subject count effect be \(b_i=0.3\), the zero-component predictor be \(-1.786\) at both visits, and exposures be \(t_{i1}=1\) and \(t_{i2}=3\). Calculate the conditional probability of a zero at visit 1 followed by a count of 1 at visit 2.
The zero probability at either visit is \(\pi=1/(1+\exp(1.786))\), approximately \(0.1436\), so \(1-\pi\approx0.8564\). The count means are \(\mu_{i1}=1(1.5)\exp(0.3)\approx2.0248\) and \(\mu_{i2}=3(1.5)\exp(0.3)\approx6.0744\).
At visit 1, the observed zero can come from either component: \(q_{i1}=\pi+(1-\pi)\exp(-\mu_{i1})\approx0.256632\). At visit 2, a positive count of 1 must come from the count component: \((1-\pi)\exp(-\mu_{i2})\mu_{i2}\approx0.0119711\). Conditional independence across visits therefore gives \(0.256632\times0.0119711\approx0.003072\), or about \(0.3072\%\). This is conditional on the stated subject effects, not a population-average probability.
Worked Example: Shared Heterogeneity Changes Joint Zero Probability
Suppose two visits have the same exposure, \(\pi=0.20\), \(\mu_{ij}=\exp(b_i)\), and \(b_i\sim N(0,0.5^2)\). Thus the variance of \(b_i\) is \(0.25\). At a given \(b_i\), the probability of a zero at either visit is \(q(b_i)=0.20+0.80\exp\{-\exp(b_i)\}\). Estimate the marginal probability of two zeros and compare it with the product of the marginal zero probabilities.
For illustration, use five-point Gauss–Hermite quadrature for the standard normal expectation, with nodes \(z=0,\pm1.3556,\pm2.8570\) and weights \(0.53333,0.22208,0.01126\) (each noncentral weight applies to both signs). Evaluate \(q(0.5z)\). The values are approximately \(0.4943\) at zero, \(0.3116\) and \(0.6815\) at the first pair, and \(0.2123\) and \(0.8295\) at the second pair.
The marginal probability of a zero at one visit is therefore approximately \(0.53333(0.4943)+0.22208(0.3116+0.6815)+0.01126(0.2123+0.8295)=0.4959\). For two zeros, average the squared conditional probability: \(0.53333(0.4943^2)+0.22208(0.3116^2+0.6815^2)+0.01126(0.2123^2+0.8295^2)\approx0.2633\).
If the visits were marginally independent, the joint probability would be \(0.4959^2\approx0.2459\). The shared random intercept instead gives an approximate joint-zero probability of \(0.2633\). Subjects with larger \(b_i\) tend to have fewer zeros at both visits, while those with smaller \(b_i\) tend to have more zeros at both; this clustering remains after averaging over subjects.
Worked Example: Interpreting an Exposure and Visit Effect
For a hypothetical subject, suppose \(b_i=0.1\), \(\pi_{ij}=0.20\), and \(\log(\mu_{ij})=\log(t_{ij})+\log(2)+0.4x_{ij}+b_i\). Let both visits have exposure \(t=2\), with \(x_{i1}=0\) and \(x_{i2}=1\). Find the conditional marginal count means and interpret the change.
At the first visit, \(\mu_{i1}=2(2)\exp(0.1)=4.4207\), so \(E(Y_{i1}\mid b_i,u_i)=(1-0.20)(4.4207)=3.5366\) counts. At the second visit, \(\mu_{i2}=2(2)\exp(0.4+0.1)=6.5949\), giving \(E(Y_{i2}\mid b_i,u_i)=0.80(6.5949)=5.2759\) counts.
Holding exposure, subject effect, and zero probability fixed, the covariate change multiplies the count-component mean by \(\exp(0.4)\approx1.492\), about a 49.2% increase. The marginal expected count is multiplied by the same factor here because the zero probability is unchanged. These are conditional expectations for the specified subject, not causal effects or population-average estimates.
Specification, Diagnostics, and Alternatives
The model’s assumptions should be examined in the context of the data-collection process. The structural-zero mechanism must be a plausible representation of extra zeros, rather than a label attached to every observed zero: a zero may also arise from the Poisson component. The random-effects distribution, link functions, exposure offset, and conditional independence across visits are modeling assumptions, not facts guaranteed by repeated measurements.
Useful checks include comparing observed and fitted zero frequencies by visit and covariate pattern; inspecting the distribution of positive counts; and comparing observed within-subject summaries, such as the frequency of subjects with zeros at all visits, with model-based simulations. Residual patterns over visit order or elapsed time can signal dependence not captured by a random intercept. Very sparse positive counts, few subjects, or little variation in zero patterns can make the count and zero components difficult to distinguish. Estimated random-effect variances near zero or unstable estimates can also indicate weak information or an overcomplicated structure.
The principal alternatives answer different questions. A zero-inflated model with no random effects treats observations as independent conditional only on measured covariates and may understate clustering. A count GLMM without a zero-inflation component can represent subject heterogeneity but may fit poorly if the zero process is genuinely distinct. A marginal approach such as generalized estimating equations targets population-average relationships and specifies a working within-subject association rather than a latent subject distribution. Separate visit-by-visit models discard the joint structure. None is automatically preferable; selection depends on the scientific target, design, fit, and available information.
A shared random intercept induces dependence through stable subject heterogeneity, but it may be insufficient when subjects have different time trends or when association changes with time separation. It also assumes a particular random-effects distribution and can be computationally demanding because the likelihood requires integration. A subject-level structural-zero state, in which one latent indicator forces every visit for a subject to zero, is a different model from the observation-level indicators specified here; it produces a different joint distribution and should be used only when scientifically justified.
Common Mistakes
- Multiplying marginal probabilities as if visits were independent. Conditional independence given random effects does not imply marginal independence. Integrate the product over the shared effects.
- Calling every observed zero structural. The count-generating distribution also assigns probability to zero; use the mixture probability for an observed zero.
- Confusing an observation-level zero state with a subject-level state. Independent visit indicators allow a subject to be structural-zero at one visit but not another. A single shared subject indicator imposes a stronger, different model.
- Interpreting a conditional effect as a population-average effect. A coefficient describes the linear predictor conditional on random effects; averaging predictions over the random-effects distribution can produce different marginal contrasts.
- Assuming a random intercept captures every temporal pattern. It induces persistent association but does not automatically model serial correlation that depends on visit order or time gaps.
Check Your Understanding
Answer each question, then compare with the solutions below.
- In a two-visit zero-inflated GLMM, why is the joint probability of two zeros generally not the product of the two marginal zero probabilities?
- If \(P(Y_{i1}=0\mid b_i,u_i)=0.4\) and \(P(Y_{i2}=0\mid b_i,u_i)=0.5\) for fixed effects, what is the conditional probability of two zeros under conditional independence?
- For a model with fixed \(\pi=0.10\) and conditional count mean \(\mu=2\), calculate the conditional probability of zero.
- What within-subject structure is not necessarily captured by a shared random intercept?
Solutions. (1) The joint probability averages the product of visit-specific probabilities over shared effects, whereas the product of marginal probabilities multiplies two separate averages; these are unequal when the probabilities co-vary. (2) Conditional independence gives \(0.4\times0.5=0.20\). (3) The zero probability is \(\pi+(1-\pi)e^{-\mu}=0.10+0.90e^{-2}\approx0.2218\). (4) A random intercept does not, by itself, represent association that changes with visit order or elapsed time; an additional temporal structure may be needed.