Why the Random-Effects Distribution Matters
A GLMM describes responses conditionally on cluster effects, but a marginal mean averages over a distribution of those effects. The familiar integration against one common random-effects distribution is appropriate only when that distribution is the right one for the covariates being held fixed. If clusters with different covariates tend to have different random effects, the relevant distribution changes with those covariates, and so can the population-averaged response.
This is not a minor technical adjustment. A conditional coefficient describes the response model given the random effect; a marginal prediction also reflects which clusters are represented at a given covariate value. Conditioning on the wrong random-effects distribution can therefore produce a different prediction even when the conditional response model is unchanged.
The Conditional Integration Formula
Suppose the conditional mean follows a GLMM with link function \(g\): \(E(Y_{ij}\mid b_j,x_{ij},C_j)=g^{-1}(x_{ij}^{T}\beta+z_{ij}^{T}b_j)\), where \(z_{ij}\) is the random-effects design vector. By the law of total expectation, the marginal mean at specified covariates is
The integration is on the response scale: apply the inverse link for each value of \(b\), then average those conditional means. The distribution in the integral is \(f(b\mid C_j=c)\), not automatically the unconditional distribution \(f(b)\). If \(b_j\) is independent of \(C_j\), then \(f(b\mid C_j=c)=f(b)\) and the usual common-distribution formula follows. If that independence assumption is not credible, the common-distribution formula does not generally give the stated conditional marginal mean.
A common specification is a normal random-effects distribution whose mean depends on cluster covariates:
where \(D\) describes how the conditional mean of the cluster effects changes with \(c\), and \(\Sigma\) is the conditional covariance matrix. A more general model can allow the covariance, or the distributional shape, to depend on \(c\) as well. The conditional response model and the conditional distribution of \(b_j\) are distinct parts of the specification: dependence in the latter does not, by itself, change the meaning of the former’s coefficients.
Derivation: Why Conditional Integration Is Required
Write \(m(x,b)=g^{-1}(x^T\beta+z^Tb)\). For clusters with \(C_j=c\), the conditional response mean at a fixed random effect is \(m(x,b)\). Averaging over the random effects actually represented among those clusters gives
When the random-effects distribution depends on cluster covariates \(C_j\), and its conditional form does not otherwise depend on the member-specific \(x_{ij}\), this reduces to the formula using \(f(b\mid C_j=c)\). The reduction relies on that modeling condition. If the distribution also depends on the individual covariate, or on a larger cluster covariate history, the conditioning information in the density must be expanded accordingly. In particular, it is not enough to condition on one member’s covariate if the model says cluster effects depend on the cluster’s full covariate pattern.
This argument is simply iterated expectation, but it identifies exactly where the independence assumption enters: it is used to replace the conditional density of \(b_j\) by a common density. It is not a consequence of the inverse-link function or of the response family.
Worked Example: A Gaussian Random-Intercept Model
Consider the hypothetical model \(Y_{ij}=\beta_0+\beta_1x_{ij}+b_j+\varepsilon_{ij}\), with \(E(\varepsilon_{ij}\mid b_j,x_{ij},C_j)=0\), and \(b_j\mid W_j=w\sim N(\delta_0+\delta_1w,\tau^2)\). Take \(\beta_0=10\) response units, \(\beta_1=2\) response units per covariate unit, \(\delta_0=1\) response unit, \(\delta_1=3\) response units per unit of \(W_j\), \(x=4\), and \(w=1\). The model’s conditional mean is linear in \(b_j\), so its marginal mean is the conditional mean with \(b_j\) replaced by \(E(b_j\mid W_j=w)\):
For clusters with \(W_j=1\), the mean random intercept is 4 response units, not zero. Using a mean-zero random intercept distribution would instead give \(10+8=18\), which is not the marginal mean for this covariate stratum. The calculation assumes the stated conditional mean model and zero-mean residuals; the normality of \(b_j\mid W_j\) is not needed for this identity-link mean, though it specifies more than just its mean.
Nonlinear Links: The Distribution Shape Also Matters
With a nonlinear inverse link, substituting the conditional mean of \(b_j\) into the linear predictor generally does not produce the marginal mean. One must average the inverse-link response over the full conditional distribution. The following probit model gives a closed-form illustration.
Worked Example: A Probit Mean With a Covariate-Dependent Random Intercept
Suppose \(Y_{ij}\) is binary and \(P(Y_{ij}=1\mid x_{ij},W_j,b_j)=\Phi(\beta_0+\beta_1x_{ij}+b_j)\), where \(\Phi\) is the standard normal cumulative distribution function. Assume \(b_j\mid W_j=w\sim N(\delta_0+\delta_1w,\tau^2)\). Use the hypothetical values \(\beta_0=-0.8\), \(\beta_1=0.6\), \(\delta_0=0.2\), \(\delta_1=0.5\), \(\tau=0.75\), \(x=1\), and \(w=1\).
To integrate, write \(b_j=m(w)+\tau Z\), where \(m(w)=\delta_0+\delta_1w\) and \(Z\sim N(0,1)\). If \(U\sim N(0,1)\) is independent of \(Z\), then \(E\{\Phi(a+\tau Z)\}=P(U\leq a+\tau Z)=P(U-\tau Z\leq a)\). Since \(U-\tau Z\sim N(0,1+\tau^2)\), this probability is \(\Phi\{a/\sqrt{1+\tau^2}\}\). Thus,
Substituting the hypothetical values gives
The predicted marginal probability of response \(1\) is approximately 0.6554 for the stated covariates and random-effects distribution. If one incorrectly imposed a mean-zero random intercept distribution at \(W_j=1\), the calculation would be \(\Phi\{(-0.8+0.6)/1.25\}=\Phi(-0.16)\approx0.4364\). The difference comes from the assumed distribution of cluster effects at \(W_j=1\), not from a change in the conditional probit coefficients.
For a logistic link, the same conditional integration formula applies, but a normal random intercept generally does not yield this probit closed form. Numerical integration or other appropriate computation may be needed. The next example uses a discrete conditional distribution so that the averaging can be seen directly.
Worked Example: Logistic Marginal Probabilities Under Two Distributions
Suppose the hypothetical conditional model is \(P(Y_{ij}=1\mid x_{ij},b_j)=\operatorname{logit}^{-1}(-1+0.8x_{ij}+b_j)\). Let \(x=1\). For clusters with \(W_j=0\), suppose \(b_j=-1\) or \(1\), each with probability \(0.5\). For clusters with \(W_j=1\), suppose \(b_j=0\) with probability \(0.75\) and \(b_j=2\) with probability \(0.25\). These are valid, explicitly specified conditional distributions for this illustration.
At \(W_j=0\), the linear predictors are \(-1+0.8-1=-1.2\) and \(-1+0.8+1=0.8\). Therefore,
At \(W_j=1\), the two linear predictors are \(-1+0.8+0=-0.2\) and \(-1+0.8+2=1.8\). Thus,
The marginal probability is higher in the \(W_j=1\) stratum under these assumptions. This comparison is descriptive of the specified model and strata; it does not establish that changing \(W_j\) would cause an outcome change. Also, the different means of the two random-effects distributions are not enough to recover these logistic marginal probabilities: the full distributions enter the nonlinear averages.
Assumptions, Diagnostics, and Alternatives
A covariate-dependent integration is meaningful only in relation to a clearly stated model and target. In particular, check the following:
- Correct conditioning information. Specify which covariates determine the distribution of cluster effects. A cluster-level covariate, a cluster summary of member-level covariates, and a single member’s covariate are not interchangeable.
- Conditional response model. State the response distribution, link, fixed-effects design, and random-effects design. The integration formula uses that conditional mean and does not repair misspecification of it.
- Conditional random-effects model. Specify \(f(b_j\mid C_j)\), including its mean and any modeled covariance or shape dependence. A normal distribution is an assumption, not a consequence of clustering.
- Target population and weights. A mean at fixed \(C_j=c\) is a stratum-specific mean. For an overall mean, average these conditional means using the target population’s distribution of \(C_j\); changing that distribution changes the estimand.
- Data support and identification. The data need enough information across covariate values to distinguish conditional response effects from changes in the distribution of cluster effects. Sparse covariate strata or few clusters can make this separation unstable.
Useful checks include examining whether cluster-level covariates are associated with estimated cluster deviations under a preliminary model, inspecting the covariate distribution and cluster counts, and checking whether the assumed conditional distribution fits the observed between-cluster pattern. Estimated random effects are shrunken estimates, so a plot of them against covariates is a diagnostic prompt rather than a definitive test of independence. Sensitivity analyses can compare plausible conditional distributions or mean structures. A lack of an obvious trend in a diagnostic plot does not prove independence.
The main alternatives answer different questions. A conventional random-effects model uses one common distribution, often a mean-zero normal distribution, and is appropriate when that assumption fits the intended conditioning and sampling structure. A covariate-dependent random-effects model changes the distribution used for integration and directly represents the dependence specified here. Empirical standardization can then average predictions over an explicitly chosen covariate distribution, but it does not remove the need to define the conditional random-effects model. Generalized estimating equations (GEE) provide a population-averaged modeling approach with a different specification strategy; they are not simply the same GLMM integration with another name.
One common specification, often called a correlated random-effects or within-between formulation, allows the random-effect distribution’s mean to depend on cluster-level covariate summaries. Such a formulation can represent a particular form of dependence, but it does not guarantee that all dependence has been captured. Conversely, simply adding a cluster covariate to the conditional response predictor does not necessarily model dependence between that covariate and the random effects: those are different model components.
Common Pitfalls and Limits
- Using the unconditional distribution at every covariate value. This silently assumes that the random-effects distribution is unchanged by those covariates. Use the conditional distribution when the model says it varies.
- Averaging the linear predictor instead of the response mean. For nonlinear links, in general \(E\{g^{-1}(\eta)\}\neq g^{-1}\{E(\eta)\}\). Integrate the inverse-link mean over the specified random-effects distribution.
- Confusing a response-model covariate effect with a distributional effect. A covariate can enter the conditional predictor, the distribution of \(b_j\), or both. State which role it plays; do not interpret one as the other.
- Calling a conditional stratum mean a universal population mean. A prediction at fixed \(C_j=c\) applies to that stratum. An overall mean requires a further average over a stated target distribution of \(C_j\).
The method’s flexibility has costs. Conditional random-effects distributions may be hard to identify separately from response-model effects, particularly with few clusters or limited covariate overlap. Results can also be sensitive to distributional assumptions and to whether the target covariates describe the clusters adequately. Marginalization makes an estimand explicit; it does not make it assumption-free or causal.
Check Your Understanding
Answer each question, then compare your reasoning with the concise solutions.
- If \(b_j\mid W_j=w\) has mean \(2w\), what distribution should be used to calculate the marginal mean at \(W_j=3\)?
- For an identity-link model with conditional mean \(5+x+b_j\) and \(E(b_j\mid W_j=2)=4\), calculate the marginal mean at \(x=3,W_j=2\).
- Why is \(\operatorname{logit}^{-1}\{E(\eta)\}\) generally not the logistic marginal probability?
- A researcher wants an overall mean across clusters with different \(W_j\). Is the mean at one fixed value of \(W_j\) sufficient? What else is required?
Solutions. (1) Use \(f(b_j\mid W_j=3)\), whose mean is \(2(3)=6\); do not substitute the unconditional distribution unless it is valid conditional on \(W_j=3\). (2) The mean is \(5+3+4=12\) response units. (3) The logistic inverse link is nonlinear, so averaging its values over \(b_j\) is generally different from applying it to the average linear predictor; the distribution’s variability and shape matter. (4) No. Average the stratum-specific marginal means over the target population’s distribution of \(W_j\), with weights matching that target.