Tutorials › Generalized Linear Mixed Models (GLMM) › Marginal Risk Ratios In Binary GLMMs

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

Marginal Risk Ratios In Binary GLMMs

Learn how to calculate a population-averaged risk ratio from integrated GLMM probabilities and interpret its difference from conditional effects.

Advanced 12 min read

What You'll Learn

  • Define a marginal risk ratio as a ratio of integrated event probabilities.
  • Distinguish a marginal risk ratio from conditional risks and conditional risk ratios.
  • Calculate marginal risks from a random-intercept model using weighted integration.
  • Use the delta method and the covariance of estimated risks to form a confidence interval.
  • Check integration, model assumptions, and uncertainty calculations for common failure modes.
  • Explain when rare outcomes make a logistic-model marginal risk ratio close to its conditional coefficient exponentiated.

From Integrated Risks to a Risk Ratio

For a binary outcome, a risk is an event probability. In a generalized linear mixed model, that probability may depend on a cluster-specific random effect. A marginal risk averages the conditional probability over the random-effect distribution; a marginal risk ratio compares two such averaged risks. The order matters: integrate each risk first, then take their ratio.

Consider a logistic random-intercept model for a binary outcome \(Y\), with exposure or group indicator \(A\in\{0,1\}\), covariates \(x\) held fixed, and cluster random intercept \(b\):

$$ P(Y=1\mid A=a,x,b) = \operatorname{expit}(\beta_0+\beta_A a+x^\top\beta_x+b), \qquad \operatorname{expit}(u)=\frac{1}{1+\exp(-u)}. $$

The usual random-intercept specification assumes \(b\) has a specified distribution, commonly \(N(0,\sigma_b^2)\), and is independent of the covariates and exposure under the model. For a population-averaged contrast at the fixed covariate value \(x\), the same random-effect distribution is used for both exposure levels. The model must also be an adequate description of the conditional event probabilities and their dependence structure. These are modeling assumptions, not consequences of calculating a ratio.

Definition: Write \(p_a(b,x)=P(Y=1\mid A=a,x,b)\). The marginal risk at exposure level \(a\), averaged over the random-effect distribution \(F_b\), is $$ \mu_a(x)=\int p_a(b,x)\,dF_b(b). $$ The marginal risk ratio comparing level 1 with level 0 is $$ RR_{\mathrm{marg}}(x)=\frac{\mu_1(x)}{\mu_0(x)}, $$ provided \(\mu_0(x)>0\). It compares the event probabilities averaged over the specified random-effect distribution, at the stated covariate value.

This definition does not average over a covariate distribution: \(x\) is held fixed. It is also distinct from the conditional risk ratio \(p_1(b,x)/p_0(b,x)\), which compares probabilities for a specified random-effect value. In a logistic model, \(\exp(\beta_A)\) is a conditional odds ratio, not generally a conditional risk ratio and not the marginal risk ratio.

Why the Ratio Comes After Integration

The law of total expectation gives \(\mu_a(x)=E_b\{p_a(b,x)\}\). Therefore the marginal risk ratio is \(E_b\{p_1(b,x)\}/E_b\{p_0(b,x)\}\). It is generally not the average of the conditional ratios. To see why, let \(r(b)=p_1(b,x)/p_0(b,x)\). Since \(p_1(b,x)=r(b)p_0(b,x)\),

$$ RR_{\mathrm{marg}}(x) = \frac{E_b\{r(b)p_0(b,x)\}}{E_b\{p_0(b,x)\}}. $$

Thus, the marginal ratio is a weighted average of conditional ratios, with weights proportional to the reference-group risk \(p_0(b,x)\); it is not usually their unweighted average. If the conditional risk ratio is the same constant \(r\) for every \(b\), then \(p_1(b,x)=r p_0(b,x)\), and integration gives \(\mu_1(x)=r\mu_0(x)\). In that special case the marginal and conditional risk ratios agree. A logistic model does not generally have a constant conditional risk ratio: its probability ratio can vary with both \(b\) and the baseline risk.

Worked Example: Integrating Risks in a Random-Intercept Model

Suppose a hypothetical binary-outcome model has \(\beta_0=-2\), \(\beta_A=1\), no additional covariates, and a random intercept taking values \(-1,0,1\) with probabilities \(0.25,0.50,0.25\), respectively. This finite distribution is stipulated for the example, so the weighted sums below are the exact marginalization under that model.

For group 0, the conditional probabilities at the three random-intercept values are \(\operatorname{expit}(-3)=0.04743\), \(\operatorname{expit}(-2)=0.1192\), and \(\operatorname{expit}(-1)=0.2689\). Hence

$$ \widehat{\mu}_0 = 0.25(0.04743)+0.50(0.1192)+0.25(0.2689) \approx 0.1387. $$

For group 1, the corresponding linear predictors are \(-2,-1,0\), giving conditional probabilities \(0.1192,0.2689,0.5000\). Thus

$$ \widehat{\mu}_1 = 0.25(0.1192)+0.50(0.2689)+0.25(0.5000) \approx 0.2893, \qquad \widehat{RR}_{\mathrm{marg}} = \frac{0.2893}{0.1387} \approx 2.086. $$

Under this hypothetical model and random-effect distribution, the event risk averaged over random intercepts is about 2.09 times as high for group 1 as for group 0. The conditional risk ratios are not all 2.086: at \(b=-1\), \(0.1192/0.04743\approx2.513\); at \(b=0\), \(0.2689/0.1192\approx2.256\); and at \(b=1\), \(0.5000/0.2689\approx1.859\). Also, \(\exp(\beta_A)=\exp(1)\approx2.718\) is the conditional odds ratio, not any of those risk ratios. These distinctions follow from the logistic link and the changing baseline risk.

Estimation and Uncertainty

In practice, model parameters and the random-effect distribution are estimated from data. A marginal risk is calculated by substituting fitted parameters into the conditional probability and integrating over the fitted random-effect distribution. For a normal random intercept, this integral usually has no elementary closed form; numerical quadrature or simulation can approximate it. Both exposure-specific risks must be calculated using the same integration rule and the same fitted random-effect distribution.

For uncertainty in a ratio of estimated marginal risks, a useful large-sample approximation works on the log scale. If \(\widehat{\mu}_1\) and \(\widehat{\mu}_0\) have estimated variances \(V_1,V_0\) and covariance \(C\), the delta method gives

$$ \widehat{SE}\{\log(\widehat{RR}_{\mathrm{marg}})\} \approx \sqrt{ \frac{V_1}{\widehat{\mu}_1^2} + \frac{V_0}{\widehat{\mu}_0^2} - \frac{2C}{\widehat{\mu}_1\widehat{\mu}_0} }. $$

The covariance term matters because both predicted risks are typically calculated from the same fitted model. An approximate 95% confidence interval is formed on the log scale as \(\log(\widehat{RR}_{\mathrm{marg}})\pm1.96\widehat{SE}\), then exponentiated at both endpoints. This interval describes uncertainty in the estimated model-based marginal risk ratio under the model and approximation; it is not a probability statement about whether a fixed parameter lies in this particular interval.

Worked Example: A Delta-Method Interval for the Marginal Risk Ratio

Suppose a hypothetical fitted model gives marginal risk estimates \(\widehat{\mu}_1=0.2392\) and \(\widehat{\mu}_0=0.1434\). Suppose their estimated standard errors are \(0.018\) and \(0.012\), and their estimated covariance is \(C=0.0000648\). These inputs are assumed to include uncertainty from fitting the model and computing the marginal risks.

The estimated ratio and its logarithm are

$$ \widehat{RR}_{\mathrm{marg}} = \frac{0.2392}{0.1434} \approx1.6681, \qquad \log(\widehat{RR}_{\mathrm{marg}}) \approx0.51166. $$

The risk variances are \(V_1=(0.018)^2=0.000324\) and \(V_0=(0.012)^2=0.000144\). Substitution into the delta-method formula gives

$$ \begin{aligned} \widehat{SE}\{\log(\widehat{RR}_{\mathrm{marg}})\} &\approx \sqrt{ \left(\frac{0.018}{0.2392}\right)^2+ \left(\frac{0.012}{0.1434}\right)^2- \frac{2(0.0000648)}{(0.2392)(0.1434)} }\\ &\approx \sqrt{0.00888714} \approx 0.09427. \end{aligned} $$

The approximate 95% interval on the log scale is \(0.51166\pm1.96(0.09427)\), or approximately \((0.3269,0.6964)\). Exponentiating its endpoints gives \((1.387,2.007)\). Under the fitted model, this interval is compatible with marginal risk ratios from about 1.39 to 2.01. Since the interval excludes 1, it indicates evidence against equal marginal risks at the usual two-sided 5% level under the approximation. The estimated group 1 risk is \(66.8\%\) higher than the group 0 risk, because \((1.6681-1)\times100\%\approx66.81\%\); this is an association, not by itself a causal conclusion.

Rare Outcomes, Diagnostics, and Alternatives

Worked Example: Why a Rare-Outcome Approximation Can Work

Consider a hypothetical logistic random-intercept model with \(\beta_0=-5\), \(\beta_A=0.7\), and a random intercept taking \(-0.5\) and \(0.5\) with equal probabilities. In group 0 the two conditional risks are \(\operatorname{expit}(-5.5)\approx0.004070\) and \(\operatorname{expit}(-4.5)\approx0.01099\), so \(\mu_0\approx(0.004070+0.01099)/2=0.007529\). In group 1 they are \(\operatorname{expit}(-4.8)\approx0.008163\) and \(\operatorname{expit}(-3.8)\approx0.02188\), so \(\mu_1\approx(0.008163+0.02188)/2=0.01502\). Therefore \(RR_{\mathrm{marg}}\approx0.01502/0.007529=1.995\), close to \(\exp(0.7)=2.014\).

This closeness is explained by the approximation \(\operatorname{expit}(u)\approx\exp(u)\) when \(u\) is sufficiently negative. Then the group-specific conditional risks are approximately proportional by \(\exp(\beta_A)\) at each \(b\), and the common random-effect factor approximately cancels in the marginal ratio. This is an approximation, not an identity; it can be poor when event risks are not small.

For a logistic GLMM, useful checks include verifying that integrated risks lie between 0 and 1, that the same random-effect distribution is used in both groups, and that tighter quadrature or additional simulation draws leave the estimated ratio stable. Large changes with integration settings suggest numerical error. Compare fitted and observed event frequencies across groups and clusters, and investigate implausible random-effect estimates, sparse events, separation, or poor fit. If the reference marginal risk is near zero, the ratio and its log can be unstable; a symmetric normal approximation on the ratio scale is then especially unreliable. The delta method also depends on adequate large-sample behavior. A parametric bootstrap that refits the model and recomputes both integrated risks can provide an alternative uncertainty assessment, though it does not repair model misspecification.

A risk difference, \(\mu_1-\mu_0\), answers an absolute-change question, whereas the risk ratio expresses a relative change. A marginal odds ratio compares \(\mu_1/(1-\mu_1)\) with \(\mu_0/(1-\mu_0)\); it is a different contrast and can differ from the conditional odds ratio even apart from confounding. The earlier material on marginal odds ratios and noncollapsibility develops that odds-scale distinction. A population-averaged estimating approach such as generalized estimating equations can estimate marginal associations directly, while a GLMM specifies conditional probabilities and obtains marginal risks by integration. The approaches use different modeling assumptions and do not automatically target identical estimands. Neither choice removes the need to define the population and contrast clearly.

The marginal risk ratio depends on the fixed covariate values, the random-effect distribution, and the model specification. A ratio calculated at one \(x\) need not represent a population with a different covariate composition. It also does not alone establish a causal effect: causal interpretation requires an appropriate design and additional assumptions. The risk ratio is undefined when the reference marginal risk is zero, and estimates can be imprecise when that risk is very small.

Common Mistakes

  • Taking the ratio before averaging. Averaging conditional ratios is not generally the same as dividing the integrated risks; the latter is the marginal risk ratio.
  • Calling \(\exp(\beta_A)\) the risk ratio in a logistic model. It is the conditional odds ratio. Conditional risks and their ratio depend on the baseline risk and random effect.
  • Ignoring covariance in uncertainty calculations. The two marginal risks come from the same fitted model, so their estimates are usually correlated.
  • Interpreting the result as a causal effect automatically. A model-based marginal association is not causal without suitable design and identification assumptions.
Key takeaway: Integrate the model-based event probability separately at each exposure level, then divide the resulting marginal risks. State the covariate values and random-effect distribution defining the averaging, and distinguish the resulting risk ratio from conditional odds ratios and conditional risks.

Check Your Understanding

Answer each question, then compare with the short solutions.

  1. If \(E_b\{p_1(b)\}=0.18\) and \(E_b\{p_0(b)\}=0.12\), what is the marginal risk ratio and its relative-risk interpretation?
  2. When does a constant conditional risk ratio equal the marginal risk ratio? Give the algebraic reason.
  3. In a logistic random-intercept model, what does \(\exp(\beta_A)\) represent, and why is it generally not the marginal risk ratio?
  4. Why should the covariance of the estimated marginal risks be included in a delta-method standard error for the log ratio?

Solutions. 1. \(RR_{\mathrm{marg}}=0.18/0.12=1.5\); the averaged event risk is 1.5 times as high, or 50% higher, at level 1 than level 0. 2. If \(p_1(b)=r p_0(b)\) for every \(b\), then \(E_b\{p_1(b)\}=rE_b\{p_0(b)\}\), so the ratio of expectations is \(r\). 3. It is the conditional odds ratio; the logistic probability ratio varies with baseline risk and \(b\), and integration further changes the contrast. 4. The two risks are estimated from the same fitted model and are generally dependent; omitting their covariance can misstate the variance of their log ratio.

Clinical Biostats