Tutorials › Generalized Linear Mixed Models (GLMM) › Marginal Means In A Log-Link Gaussian-Effects Model

Marginal Effects and Population-Averaged Estimates · Tutorial 409 of 698

Marginal Means In A Log-Link Gaussian-Effects Model

Learn to integrate out a normal random intercept under a log link and interpret how its variance changes population-averaged means.

Advanced 11 min read

What You'll Learn

  • Distinguish a conditional mean from a population-averaged mean in a log-link GLMM.
  • Derive the marginal-mean adjustment using the normal moment-generating function.
  • Calculate how random-intercept variance changes means on the response scale.
  • Compare marginal means across groups with equal or unequal random-effect variances.
  • Recognize assumptions, diagnostics, and limitations of the closed-form result.

Why the Random-Effect Variance Changes the Mean

In a generalized linear mixed model, a conditional mean is specified given the random effect. A population-averaged mean instead averages that conditional mean over the random-effects distribution. With a log link, this averaging has a particularly simple form when the random effect is normal: its variance contributes a positive term to the logarithm of the marginal mean. Thus, evaluating the conditional mean at a random effect of zero does not generally give the population-averaged mean.

This result concerns the mean of the response, not the distribution of the response. A normal random intercept does not imply that the outcome itself is normally distributed. The conditional outcome distribution may be selected for the application; the derivation below requires the stated conditional mean and random-effect assumptions.

Definition: Consider a random-intercept model with covariates \(x\), fixed-effect coefficient vector \(\beta\), and cluster-specific random intercept \(b\). The conditional mean is \(\mu(x,b)=E(Y\mid x,b)\), with log link \(\log\{\mu(x,b)\}=x^\mathsf{T}\beta+b\). Assume \(b\sim N(0,\tau^2)\) and that this distribution is the same across the covariate values being compared. The marginal mean is \(m(x)=E_b\{E(Y\mid x,b)\}\), where the expectation averages over the random-effects distribution.

Here \(x^\mathsf{T}\beta\) is the fixed part of the linear predictor, and \(b\) is a deviation on the log-mean scale. Consequently, \(\tau^2\) is measured in squared log-mean units. The model assumes a mean-zero random intercept; its variance is nonnegative. The covariates are treated as fixed or, equivalently for this calculation, the random-effect distribution is independent of their values. If the random-effect distribution changes with \(x\), the same simple adjustment need not apply.

Deriving the Marginal Mean

Given \(b\), the log link gives \(\mu(x,b)=\exp(x^\mathsf{T}\beta+b)\). Taking the expectation over \(b\) factors out the fixed part. For a normal random variable, the moment-generating function is \(E\{\exp(t b)\}=\exp(t^2\tau^2/2)\). Setting \(t=1\) yields the marginal-mean formula.

$$ \begin{aligned} m(x) &=E_b\{\exp(x^\mathsf{T}\beta+b)\}\\ &=\exp(x^\mathsf{T}\beta)E_b\{\exp(b)\}\\ &=\exp(x^\mathsf{T}\beta)\exp(\tau^2/2)\\ &=\exp(x^\mathsf{T}\beta+\tau^2/2). \end{aligned} $$

The normal expectation can also be justified directly when \(\tau^2>0\). The density of \(b\sim N(0,\tau^2)\) is proportional to \(\exp\{-b^2/(2\tau^2)\}\). Combining it with \(\exp(b)\) in the expectation gives \(\exp\{b-b^2/(2\tau^2)\}\). Completing the square, \(b-b^2/(2\tau^2)=-(b-\tau^2)^2/(2\tau^2)+\tau^2/2\). The shifted normal density integrates to one, leaving the factor \(\exp(\tau^2/2)\). This verifies the adjustment directly. If \(\tau^2=0\), then \(b=0\) almost surely and \(E_b\{\exp(b)\}=1=\exp(\tau^2/2)\), so the same adjustment holds.

Theorem: Under the log-link random-intercept model above, the population-averaged mean is \(m(x)=\exp(x^\mathsf{T}\beta+\tau^2/2)\). It equals the conditional mean at \(b=0\), \(\exp(x^\mathsf{T}\beta)\), multiplied by \(\exp(\tau^2/2)\). For \(\tau^2>0\), this multiplier is greater than one; for \(\tau^2=0\), the marginal and \(b=0\) conditional means coincide.

The increase is a consequence of averaging exponentials, not a claim that every cluster has a mean above the \(b=0\) value. Some random intercepts are negative and others positive, but exponentiation is nonlinear: positive deviations have a larger multiplicative impact than equally sized negative deviations. The marginal mean therefore exceeds the conditional mean at the average random effect when the variance is positive.

Worked Example: Marginal Mean From a Log-Scale Intercept

Suppose a hypothetical model has \(x^\mathsf{T}\beta=\log(3)\) for a specified covariate pattern and \(\tau^2=0.50\). The conditional mean at \(b=0\) is \(\exp\{\log(3)\}=3\) response units. The normal random-intercept assumption gives

$$ m(x)=\exp\{\log(3)+0.50/2\} =3\exp(0.25) \approx 3(1.2840) =3.852. $$

Thus, the population-averaged mean is approximately 3.852 response units, higher than the conditional mean of 3 response units at \(b=0\). This conclusion is about the average over the modeled random-intercept distribution; it does not mean that any particular cluster has an expected response of exactly 3.852.

Comparisons Across Covariate Patterns and Variances

When the same random-intercept variance applies to two covariate patterns, the variance adjustment multiplies both marginal means by the same amount. Their marginal mean ratio therefore equals their conditional mean ratio. This cancellation is specific to a shared variance and a shared random-intercept distribution. If groups have different random-effect variances, their marginal means can differ even when their conditional means at \(b=0\) are identical.

Worked Example: Equal Conditional Means, Different Variances

Consider two hypothetical populations with the same fixed linear predictor, so each has conditional mean 10 response units at \(b=0\). Suppose population A has random-intercept variance \(0.20\), while population B has variance \(0\). Assume a normal mean-zero random intercept in each population and the same log-link conditional-mean specification.

For population A,

$$ m_A=10\exp(0.20/2)=10\exp(0.10)\approx 10(1.10517)=11.05. $$

For population B,

$$ m_B=10\exp(0/2)=10. $$

The marginal mean ratio is \(m_A/m_B=\exp(0.10)\approx1.105\), so A's population-averaged mean is about 10.5% higher than B's, despite equal conditional means at \(b=0\). This comparison depends on the stipulated group-specific variances; it is not a general claim that one population's observed outcome average must exceed another's.

Worked Example: Recovering a Conditional Mean From a Marginal Target

Suppose a hypothetical population-averaged mean is 8 response units and the random-intercept variance is \(0.72\). Under the model, \(m(x)=\exp(x^\mathsf{T}\beta)\exp(0.72/2)\). To find the conditional mean at \(b=0\), divide the marginal mean by the variance multiplier:

$$ \exp(x^\mathsf{T}\beta) =\frac{8}{\exp(0.36)} =8\exp(-0.36) \approx 5.581. $$

The conditional mean at \(b=0\) is approximately 5.581 response units. Multiplying it back by \(\exp(0.36)\) recovers 8, up to rounding. This inversion is useful for understanding the scale adjustment, but it does not by itself estimate either model parameter from data.

Assumptions, Diagnostics, and Limitations

The closed form is exact under a specific set of assumptions: the conditional mean follows the log link; the random contribution is a mean-zero normal random intercept with finite variance \(\tau^2\); and the distribution is the one over which the target population is being averaged. If an offset is included in the linear predictor, it is part of the fixed predictor for this calculation. The conditional response distribution need not be normal, but its mean must have the stated form.

In applications, \(\beta\) and \(\tau^2\) are estimated. Substituting estimates into \(\exp(x^\mathsf{T}\beta+\tau^2/2)\) gives a plug-in estimate of the marginal mean; uncertainty in both estimates matters for inference. The formula itself does not provide a standard error or confidence interval. In particular, treating the estimated variance as known can understate uncertainty, especially when the number of clusters is small or the variance is near zero.

Diagnostics should assess whether the random-intercept model is plausible, rather than simply checking whether the formula can be evaluated. Examine the fitted model for influential clusters and systematic residual patterns, and assess whether the random-intercept distribution is reasonably compatible with a normal distribution. Estimated random effects are shrunken predictions, so their histogram or normal quantile plot is not a definitive test of the latent distribution. Compare model-based predictions with observed cluster-level patterns, while recognizing that noisy cluster outcomes need not reproduce the assumed random-effect distribution exactly.

The normality assumption matters because the result uses \(E\{\exp(b)\}=\exp(\tau^2/2)\). A mean-zero random effect with the same variance but a nonnormal distribution need not have this same exponential moment. A random-effects distribution with no finite \(E\{\exp(b)\}\) would not even yield a finite marginal mean through this calculation. Likewise, if a different link or a random-effect structure is used, this derivation cannot simply be carried over unchanged.

Common mistake: It is tempting to set \(b=E(b)=0\) and conclude that the population-averaged mean is \(\exp(x^\mathsf{T}\beta)\). That computes the conditional mean at the average random effect, not the expectation of the conditional mean. The correction is to average \(\exp(x^\mathsf{T}\beta+b)\) over the distribution of \(b\), which gives \(\exp(x^\mathsf{T}\beta+\tau^2/2)\).

The main alternative is to report a conditional prediction for a specified cluster or random-effect value. That answers a different question from a population-averaged prediction. For a normal random intercept and log link, integration has the closed form derived here. If the assumed distribution or link does not provide a closed form, numerical integration or simulation may be needed; neither automatically repairs a misspecified model. The result also concerns a single random intercept, not a general recipe for all random-effects structures.

Key takeaway: Under a log link and a mean-zero normal random intercept, integrating over heterogeneity multiplies the conditional mean at \(b=0\) by \(\exp(\tau^2/2)\). State the target population and random-effects assumptions before interpreting that adjustment.

Check Your Understanding

Answer each question using the log-link normal random-intercept result. Solutions follow.

  1. If the conditional mean at \(b=0\) is 4 response units and \(\tau^2=0.36\), what is the marginal mean?
  2. If the conditional mean at \(b=0\) is 10 and \(\tau^2=0.20\), calculate the marginal mean to three decimal places.
  3. A marginal mean is 6 and \(\tau^2=0.50\). What is the corresponding conditional mean at \(b=0\)?
  4. What happens to the marginal mean when \(\tau^2=0\), and why?
  5. Two covariate patterns share the same random-intercept variance. How does their marginal mean ratio relate to the ratio of their conditional means at \(b=0\)?

Solutions. (1) \(4\exp(0.36/2)=4\exp(0.18)\approx4(1.19722)=4.789\) response units. (2) \(10\exp(0.20/2)=10\exp(0.10)\approx10(1.10517)=11.052\) response units. (3) \(6\exp(-0.50/2)=6\exp(-0.25)\approx6(0.778801)=4.673\) response units. (4) The multiplier is \(\exp(0/2)=1\), so marginal and conditional means coincide because there is no random-intercept variation. (5) The ratio is unchanged: the common multiplier \(\exp(\tau^2/2)\) cancels from the two marginal means.

Clinical Biostats