Why the Scale Matters
A treatment effect can vary across a modifier, but “vary” is incomplete unless the effect scale is named. In a GLMM, a treatment-by-modifier coefficient describes how the treatment contrast changes on the model’s conditional link scale, holding random effects fixed. A contrast of response means after integrating over random effects describes a different quantity. Because the link is usually nonlinear, those two assessments need not agree.
This distinction matters when results are interpreted for a population rather than for clusters with a specified random effect. For example, a logistic GLMM’s interaction coefficient is a change in conditional log odds. It is not automatically the change in a population-averaged risk difference. To assess effect modification on the response scale, predict the response under each treatment and modifier value, average over the random-effects distribution for the target population, and then contrast those averages.
Model and Standardized Contrasts
For a generalized linear mixed model, write the conditional mean model as
Here \(g\) is the link function, and \(b\) represents the relevant random effect or effects. This expression assumes the stated fixed-effects structure is appropriate; the distribution of \(b\), including any dependence assumptions, must also be specified. For a binary outcome with a logit link, the conditional mean is a probability. For a count outcome with a log link, it is a conditional rate or mean, with any exposure offset included in the linear predictor.
At a fixed modifier value \(z\), the conditional link-scale treatment contrast for \(a_1\) versus \(a_0\) is \((a_1-a_0)(\beta_A+\beta_{AZ}z)\); for \(A=1\) versus \(A=0\), this is \(\beta_A+\beta_{AZ}z\). Thus \(\beta_{AZ}\) describes the change in the link-scale contrast per one-unit increase in \(Z\) for a one-unit increase in \(A\). This is a link-scale statement, not a general claim about response-scale differences.
For response-scale comparisons, define the marginal mean at treatment \(a\) and modifier value \(z\) as
The expectation uses the random-effects distribution for the population being described. A response-scale contrast is then formed from these averages. For example, for a binary outcome the marginal risk difference at \(z\) is \(m(1,z)-m(0,z)\). Other scales, such as a risk ratio or rate ratio, use a different contrast of the same standardized means. State the scale explicitly: effect modification on one scale does not imply effect modification on every scale.
These quantities require a well-defined target population and adequate model support for the treatment and modifier combinations being compared. The examples below use hypothetical data-generating models with specified random-effects distributions; they illustrate calculations, not evidence about an actual intervention. A causal interpretation additionally requires appropriate design and causal assumptions. A model-based contrast alone establishes an association under the model, not a causal effect.
Worked Binary-Outcome Comparison
Worked Example: Conditional Odds Ratios and Marginal Risk Differences
Consider a hypothetical logistic random-intercept model with binary treatment \(A\), binary modifier \(Z\), and cluster intercept \(b\):
For this illustration, suppose \(b=-0.4\) or \(b=0.4\), each with probability \(1/2\), and that this same distribution applies at every treatment and modifier value. The conditional model is logistic, the random-intercept distribution is specified, and we standardize by averaging the two conditional probabilities with equal weights. The outcome is a binary event, so the response-scale contrast used here is a risk difference.
At \(Z=0\), the conditional log-odds treatment contrast is \(1.2\), so the conditional odds ratio is \(\exp(1.2)\approx3.320\). At \(Z=1\), the contrast is \(1.2-0.7=0.5\), and the conditional odds ratio is \(\exp(0.5)\approx1.649\). The interaction coefficient therefore indicates a lower treatment log-odds contrast at \(Z=1\) than at \(Z=0\).
Now calculate marginal risks by integrating over \(b\). For \(A=0,Z=0\), the linear predictors are \(-1-0.4=-1.4\) and \(-1+0.4=-0.6\). Therefore,
For \(A=1,Z=0\), the predictors are \(-1+1.2-0.4=-0.2\) and \(-1+1.2+0.4=0.6\). Thus
The standardized risk difference at \(Z=0\) is \(0.5479-0.2761=0.2718\), or about 27.18 percentage points.
At \(Z=1\), for \(A=0\), the linear predictors are \(-1+0.8-0.4=-0.6\) and \(-1+0.8+0.4=0.2\). Hence
For \(A=1,Z=1\), the fixed part of the predictor is \(-1+1.2+0.8-0.7=0.3\). Adding the two random-intercept values gives \(-0.1\) and \(0.7\). Therefore,
The standardized risk difference at \(Z=1\) is \(0.5716-0.4521=0.1195\), or about 11.95 percentage points. On this hypothetical model, both scales show a smaller treatment contrast at \(Z=1\), but they quantify it differently: the conditional interaction is \(-0.7\) log-odds units, while the standardized risk difference changes from about 27.18 to 11.95 percentage points.
Why Conditional and Marginal Patterns Can Differ
The example above has a nonlinear inverse link. In general, averaging inverse-link predictions is not the same as applying the inverse link to an averaged linear predictor:
For a logistic model, the response probability is a curved function of the linear predictor. Averaging probabilities across clusters with different intercepts therefore changes the response-scale contrast in a way that cannot be read directly from \(\beta_A\) or \(\beta_{AZ}\). Even when a conditional interaction is absent, the response-scale risk difference can change across modifier values because the baseline risk changes.
Worked Example: Marginal Risk Differences Without a Conditional Interaction
Suppose a hypothetical logistic random-intercept model is
with \(b=-0.4\) or \(0.4\), each with probability \(1/2\). There is no \(AZ\) term, so the conditional log-odds treatment contrast is \(0.6\) at both modifier values; its conditional odds ratio is \(\exp(0.6)\approx1.822\).
At \(Z=0\), the control predictors are \(-1.4,-0.6\), giving \(m(0,0)=(0.1978+0.3543)/2\approx0.2761\). The treatment predictors are \(-0.8,0\), giving \(m(1,0)=(0.3100+0.5000)/2\approx0.4050\). The marginal risk difference is \(0.4050-0.2761\approx0.1289\), or 12.89 percentage points.
At \(Z=1\), the control predictors are \(-0.4,0.4\), giving \(m(0,1)=(0.4013+0.5987)/2=0.5000\). The treatment predictors are \(0.2,1.0\), giving \(m(1,1)=(0.5498+0.7311)/2\approx0.6404\). The risk difference is \(0.6404-0.5000\approx0.1404\), or 14.04 percentage points.
Thus the conditional odds ratio is constant across \(Z\), while the marginal risk difference differs modestly across \(Z\). This is not a contradiction: the two statements concern different scales. A risk difference depends on the baseline probability as well as on the odds ratio. Consequently, “no interaction” is meaningful only after naming the scale and model representation.
A Contrasting Rate-Scale Case
Nonlinearity does not make conditional and marginal effects disagree in every GLMM or on every scale. A log-link model with a random intercept illustrates a useful special case. If the random intercept has the same distribution across the treatment and modifier combinations, its multiplicative contribution cancels from a marginal rate ratio.
Worked Example: A Conditional and Marginal Rate-Ratio Comparison
Consider the hypothetical count-rate model
where rates are per person-year and \(b=-0.4\) or \(0.4\), each with probability \(1/2\). The random intercept is assumed to have the same distribution for all compared groups. The conditional treatment rate ratio is \(\exp(0.4)\approx1.492\) at \(Z=0\), and \(\exp(0.4-0.2)=\exp(0.2)\approx1.221\) at \(Z=1\).
The common multiplicative factor from averaging over \(b\) is
At \(Z=0\), the marginal control rate is \(e^{-2}C\approx0.1463\) events per person-year. The marginal treatment rate is \(e^{-2+0.4}C\approx0.2183\). Their rate ratio is approximately \(0.2183/0.1463=1.492\), and their rate difference is about \(0.0720\) events per person-year.
At \(Z=1\), the marginal control rate is \(e^{-1.5}C\approx0.2412\) events per person-year. The marginal treatment rate is \(e^{-1.5+0.2}C\approx0.2946\). The rate ratio is approximately \(0.2946/0.2412=1.221\), and the rate difference is about \(0.0534\) events per person-year. Here the conditional and marginal rate ratios show the same modifier pattern, but the rate differences still depend on baseline rate. The cancellation relies on the stated common random-effects distribution and log-link structure; it is not a general property of GLMMs.
How to Make and Check the Comparison
A defensible assessment starts by defining the estimand, not by inspecting an interaction coefficient in isolation. State the treatment contrast, the modifier values, the response scale, and the population over which predictions are averaged. For empirical standardization, that population includes a specified distribution of observed covariates as well as the random-effects distribution. If the aim is a contrast within modifier strata, preserve each stratum’s value of \(Z\) while standardizing over the other features of the target population.
Then calculate both kinds of quantities if both are scientifically relevant: the conditional link-scale contrast implied by the coefficients, and the standardized response-scale contrast formed from averaged predictions. Compare values across modifier levels on the same scale. Do not compare a conditional log-odds coefficient at one level with a marginal risk difference at another.
Several checks can reveal a fragile result:
- Check predictor arithmetic. For every treatment-modifier combination, substitute all fixed effects and the random-effect value before applying the inverse link. Small arithmetic errors can materially change standardized probabilities.
- Check the averaging distribution. Confirm that its weights describe the intended target population and that the random-effects distribution is appropriate for the clusters being summarized.
- Check support. If some treatment-modifier combinations are poorly represented, standardized contrasts may depend heavily on model extrapolation.
- Check model form. A misspecified link, omitted interaction, unsuitable random-effects structure, or unmodeled covariate relationship can distort either conditional predictions or their averages.
- Check the scale label. An interaction coefficient, odds ratio, risk difference, and rate difference are distinct quantities. State the units for absolute differences and the scale for relative effects.
A coefficient-based interaction test addresses a conditional link-scale null hypothesis. It is not, by itself, a test of every standardized response-scale contrast. Conversely, a visible difference between response-scale contrasts does not prove that a conditional interaction is present. Any inferential assessment of derived marginal contrasts must account for their estimation uncertainty; the point calculations here describe the estimands and do not provide uncertainty intervals.
Choosing an Interpretation
Conditional and marginal effects answer complementary questions. A conditional effect describes the model contrast among units with the same specified random effect, on the model’s link scale. A marginal effect describes the average response contrast for a population under a stated standardization distribution. Neither is universally preferable. A cluster-specific scientific question may favor conditional quantities; population planning or communication of absolute event frequencies may favor standardized response-scale contrasts.
The central limitation is that a marginal contrast is tied to its target population. Changing the covariate or random-effects distribution can change its value, even when the fitted conditional coefficients remain fixed. It is therefore not enough to report “the marginal effect” without saying whose average is being represented. Likewise, a conditional interaction should not be translated directly into a population risk difference or rate difference without computing the response-scale predictions.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A logistic GLMM has treatment-by-modifier coefficient \(0\). Does this guarantee a constant marginal risk difference across modifier values?
- For the binary worked example, state the conditional treatment odds ratio at \(Z=1\) and the standardized risk difference at \(Z=1\).
- Why does averaging inverse-logit predictions generally differ from applying the inverse-logit to an average linear predictor?
- In the log-link rate example, what assumption permits the random-intercept factor to cancel from the marginal rate ratio?
Solutions. (1) No. A zero interaction gives a constant conditional treatment contrast on the log-odds scale, but the marginal risk difference can vary with baseline probability, as the second worked example demonstrates. (2) The conditional log-odds contrast is \(1.2-0.7=0.5\), so the odds ratio is \(\exp(0.5)\approx1.649\). The standardized risk difference is \(0.5716-0.4521\approx0.1195\), or 11.95 percentage points. (3) The inverse-logit is nonlinear, so in general \(E_b[\operatorname{logit}^{-1}(\eta+b)]\ne\operatorname{logit}^{-1}(\eta+E_b[b])\). (4) The random intercept must have the same distribution across the treatment and modifier groups being compared, so the same factor \(E_b(e^b)\) multiplies each marginal rate and cancels in their ratio.