Tutorials › Generalized Linear Mixed Models (GLMM) › Marginal Dose-Response Curves

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

Marginal Dose-Response Curves

Learn to integrate a GLMM’s conditional mean into a population-averaged dose-response curve and calculate meaningful contrasts between doses.

Advanced 12 min read

What You'll Learn

  • Define a population-averaged dose-response curve for a specified target population.
  • Integrate conditional GLMM predictions over the random-effects distribution.
  • Calculate and interpret dose contrasts on difference and ratio scales.
  • Distinguish a marginal curve from a curve conditional on cluster effects.
  • Diagnose functional-form, random-effects, and extrapolation problems.
  • Identify assumptions required for causal interpretations of dose-response estimates.

From a Conditional GLMM to a Population-Averaged Curve

A continuous exposure can take many values, so its effect is usually more informative as a curve than as a single coefficient. In a GLMM, however, the fitted mean at a dose is generally conditional on a cluster’s random effect. A population-averaged dose-response curve answers a different question: what mean outcome would be expected at each dose after averaging over the specified population of clusters (and, when relevant, its covariates)?

The curve depends on the outcome scale and the target population. For a binary outcome it may report a marginal risk at each dose; for a count outcome it may report a marginal mean count or rate. Contrasts between chosen doses then summarize differences on a scale suited to the question. These are model-based population averages, not automatically causal effects.

Definition: Let \(Y_{ij}\) be the outcome for observation \(i\) in cluster \(j\), \(d\) a dose, \(X\) covariates, and \(B\) the cluster random effects. Write the conditional mean as \(h\{\eta(d,X,B)\}\), where \(h=g^{-1}\) is the inverse link. For a target covariate distribution \(G\) and random-effects distribution \(F_B\), the population-averaged dose-response curve is $$ m(d)=\int\!\int h\{\eta(d,x,b)\}\,dF_B(b)\,dG(x). $$ If covariates are held at specified values rather than averaged, omit the integration over \(G\) and state those values. A dose contrast compares curve values, such as \(m(d_2)-m(d_1)\) or \(m(d_2)/m(d_1)\).

A common random-intercept and random-slope specification is

$$ g\{E(Y_{ij}\mid X_{ij}=x,D_{ij}=d,B_j=b)\} = \beta_0+\beta_1d+x^\mathsf{T}\gamma+b_0+b_1d. $$

Here \(D_{ij}\) is the continuous dose, \(\beta_0,\beta_1,\gamma\) are fixed-effect coefficients, and \(b_0,b_1\) are cluster-specific deviations. The marginal curve is obtained by applying the inverse link to each conditional linear predictor and then integrating the resulting conditional means. The random-effects distribution and the target covariate distribution must therefore be specified as part of the estimand, not treated as incidental computational details.

Assumptions and a Short Derivation

The curve is meaningful under assumptions that support the fitted conditional model and its averaging operation. The conditional outcome distribution and link must be appropriate; the dose-response form in \(\eta(d,x,b)\) must represent the relationship adequately over the dose range of interest; and the random-effects distribution must be suitably specified. Usually, clusters are assumed independent, and the random effects are assumed independent of the covariates conditional on any modeled structure. If the curve averages covariates, \(G\) must represent the target population the interpretation names.

For a finite set of target covariate profiles \(x_r\) with weights \(w_r\), and a discrete random-effects distribution with support \(b_s\) and probabilities \(q_s\), the integral is the weighted sum

$$ \widehat m(d)=\sum_r\sum_s w_rq_s h\{\widehat\eta(d,x_r,b_s)\}, \qquad \sum_r w_r=1,\quad \sum_s q_s=1. $$

For continuous random effects, numerical integration or simulation approximates the same expectation. The order of operations follows directly from conditional expectation: first take the conditional mean of \(Y\) at each \(x,b,d\), then average that mean over the distributions being targeted. In general, this is not equivalent to averaging the linear predictor first and applying the inverse link once. For example, in a logistic model, Example 1 below gives an average risk of about 0.260 at dose zero, whereas applying the logistic function to the mean linear predictor gives about 0.231. The nonlinearity of the inverse link makes these distinct quantities.

Worked Example: Marginal Risks at Three Doses

Suppose a hypothetical binary outcome is recorded once per person, with people grouped in clusters. Let \(d\) be dose in 10-mg units, and suppose a fitted random-intercept logistic model is

$$ \operatorname{logit}\{P(Y=1\mid d,B)\}=-1.2+0.7d+B, \qquad P(B=-0.8)=P(B=0.8)=0.5. $$

The curve averages risks over this specified random-intercept distribution. For any dose, calculate the two conditional probabilities and take their equally weighted average.

At \(d=0\), the linear predictors are \(-1.2+0.8=-0.4\) and \(-1.2-0.8=-2.0\). Thus

$$ \widehat m(0)=\frac{\operatorname{expit}(-0.4)+\operatorname{expit}(-2.0)}{2} =\frac{0.4013+0.1192}{2}=0.2603. $$

At \(d=1\), corresponding to 10 mg, the predictors are \(0.3\) and \(-1.3\), so

$$ \widehat m(1)=\frac{0.5744+0.2142}{2}=0.3943. $$

At \(d=2\), or 20 mg, they are \(1.0\) and \(-0.6\), giving

$$ \widehat m(2)=\frac{0.7311+0.3543}{2}=0.5427. $$

The estimated marginal risk is therefore 26.03% at 0 mg, 39.43% at 10 mg, and 54.27% at 20 mg. The 20-mg versus 0-mg marginal risk difference is \(0.5427-0.2603=0.2824\), or 28.24 percentage points. This is a contrast of population-averaged risks, not a conditional coefficient or a claim that every cluster has the same increase.

Contrasts Between Selected Doses

A contrast is defined by the doses and outcome scale being compared. For a binary outcome, a risk difference is \(m(d_2)-m(d_1)\); a risk ratio is \(m(d_2)/m(d_1)\), provided the denominator is nonzero. For a count outcome, the same arithmetic applies to marginal expected counts or rates, with the rate’s time or exposure denominator stated. These contrasts are usually more interpretable when the doses and units are explicit.

With random slopes, integration accounts for variation in how clusters respond to dose. Consequently, the marginal curve need not follow the fixed-effects dose slope alone. Even when the conditional log mean is linear in dose, averaging over random slopes can change the curve’s shape on the response scale.

Worked Example: Contrasting Marginal Count Rates With Random Slopes

Consider a hypothetical Poisson GLMM for an event rate per person-period. Let \(d\) be dose in 5-mg units, and suppose

$$ \log\{E(Y\mid d,B_0,B_1)\} =0.4+0.25d+B_0+B_1d, $$

where \(B_0\) and \(B_1\) are independent, each taking its negative and positive value with probability 0.5: \(B_0=\pm0.3\), \(B_1=\pm0.1\). For a symmetric two-point variable \(B=\pm a\), \(E\{\exp(B)\}=\{\exp(a)+\exp(-a)\}/2=\cosh(a)\). Independence therefore gives

$$ m(d)=\exp(0.4+0.25d)\cosh(0.3)\cosh(0.1d). $$

At \(d=0\), the marginal rate is

$$ m(0)=\exp(0.4)\cosh(0.3) =1.4918(1.0453)=1.559 $$

events per person-period. At 5 mg (\(d=1\)) and 10 mg (\(d=2\)), respectively,

$$ m(1)=\exp(0.65)\cosh(0.3)\cosh(0.1) =1.9155(1.0453)(1.0050)=2.012, $$
$$ m(2)=\exp(0.9)\cosh(0.3)\cosh(0.2) =2.4596(1.0453)(1.0201)=2.623. $$

The 10-mg versus 0-mg rate difference, calculated from the unrounded marginal rates, is approximately \(1.063\) events per person-period; the marginal rate ratio is approximately \(2.623/1.559=1.682\). The positive random-slope variation is included in both marginal rates. Reporting only the fixed dose coefficient, 0.25 on the conditional log-rate scale, would not itself report either marginal contrast.

Worked Example: A Curved Dose-Response and Contrasts at Chosen Doses

Suppose another hypothetical binary-outcome model uses a quadratic dose term, with \(d\) again measured in 5-mg units:

$$ \operatorname{logit}\{P(Y=1\mid d,B)\} =-1+0.8d-0.2d^2+B, \qquad P(B=-0.6)=P(B=0.6)=0.5. $$

At \(d=0\), the two predictors are \(-0.4\) and \(-1.6\), so \(m(0)=(0.4013+0.1680)/2=0.2846\). At \(d=2\), the fixed part is \(-1+1.6-0.8=-0.2\), giving predictors \(0.4\) and \(-0.8\); hence \(m(2)=(0.5987+0.3100)/2=0.4544\). At \(d=3\), the fixed part is \(-1+2.4-1.8=-0.4\), so the predictors are \(0.2\) and \(-1.0\), giving risks \(0.5498\) and \(0.2689\): \(m(3)=(0.5498+0.2689)/2=0.4094\).

The 10-mg versus 0-mg marginal risk difference, calculated from the unrounded risks, is approximately \(0.1697\), or 16.97 percentage points. The 15-mg versus 0-mg marginal risk difference, calculated from the unrounded risks, is approximately \(0.1247\), or 12.47 percentage points. The fitted curve rises and then falls over these evaluated doses, so the contrast depends on which doses are selected. A single coefficient for the linear dose term cannot summarize this quadratic response pattern.

Diagnostics, Alternatives, and Limits

A calculated curve can be numerically correct for a fitted model yet poorly represent the data or the target population. Inspect observed outcome summaries across dose ranges alongside fitted marginal predictions, while remembering that raw summaries may not adjust for covariates. Look for systematic discrepancies, sparse dose regions, implausible probabilities or rates, and sensitivity to the dose functional form. For a continuous dose, compare a defensible linear specification with a quadratic or other flexible form when the data support it; do not use a flexible curve to disguise a lack of observations at the extremes.

Check whether the random-effects structure is credible, especially when random slopes are used. Estimates at doses where clusters provide little information can be strongly driven by the assumed random-effects distribution. A materially different curve under plausible alternative random-effects distributions is a warning that the marginal prediction is model-sensitive. Integration should also be checked computationally: increase numerical accuracy or simulation size and verify that the reported curve and contrasts do not change meaningfully.

A conditional GLMM curve describes outcomes at specified random-effect values, often \(B=0\); it is not generally the population average. A population-averaged model such as a generalized estimating equation is a different modeling approach that targets marginal means directly, with its own working-correlation and inference considerations. The GLMM route is useful when cluster heterogeneity is part of the model, but its marginal curve depends on both the conditional model and the random-effects distribution.

Finally, a modeled dose-response association is not automatically a causal dose-response relation. A causal interpretation requires a well-defined intervention at each dose, adequate support for those doses, and assumptions that address confounding, selection, and the way dose is assigned. Without those conditions, describe the curve as a standardized or population-averaged model prediction. For inference, uncertainty in fitted parameters and in the integrated predictions must be reflected in uncertainty for the contrast; a point estimate alone does not establish evidence against a null contrast.

Common Mistakes

  • Averaging the linear predictors. Applying the inverse link to an average predictor generally differs from averaging the conditional response means. Integrate on the response scale.
  • Calling a conditional coefficient a marginal contrast. A dose coefficient is on the link scale and conditional on random effects; calculate the curve values and subtract or divide them for the requested marginal contrast.
  • Leaving the target population implicit. State which random-effects distribution and covariate distribution are averaged over, or which covariate values are held fixed.
  • Extrapolating beyond dose support. A smooth model prediction at an unobserved dose is not evidence that the dose-response pattern is known there.
  • Using causal wording for a model-based association. Averaging predictions does not by itself remove confounding or create a causal intervention comparison.
Key takeaway: Define the target population and contrast scale, predict conditionally at each dose, and average those response-scale predictions over the specified random-effects and covariate distributions. Then interpret the resulting curve only over doses and populations supported by the model and data.

Check Your Understanding

Answer each question, then compare with the solutions below.

  1. In a logistic GLMM with random effects, should marginal risk be calculated by applying the logistic function to the average linear predictor or by averaging conditional risks? Why?
  2. A fitted marginal risk is 0.31 at 4 mg and 0.46 at 12 mg. Calculate the risk difference and interpret it.
  3. For the quadratic example above, what is the marginal risk difference comparing 15 mg with 0 mg?
  4. Name two reasons why a fitted marginal dose-response curve might not support a causal interpretation.

Solutions. (1) Average the conditional risks over the random-effects distribution (and the target covariate distribution, if applicable). The logistic function is nonlinear, so applying it to the average predictor generally gives a different result. (2) \(0.46-0.31=0.15\): the model’s marginal risk at 12 mg is 15 percentage points higher than at 4 mg for the specified target population. (3) The example gives \(m(3)-m(0)\approx0.1247\), or approximately 12.47 percentage points, using unrounded risks. (4) For example, dose may be confounded, or the observed data may not support the compared doses; either problem can undermine causal interpretation even when the model’s averaging is correctly performed.

Clinical Biostats