Tutorials › Generalized Linear Mixed Models (GLMM) › Worked Workshop: Count-Rate Marginal Effects

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

Worked Workshop: Count-Rate Marginal Effects

Learn to integrate a normal random intercept to obtain marginal count rates and compare those rates across exposure levels.

Advanced 11 min read

What You'll Learn

  • Write a Poisson random-intercept model with a person-time offset.
  • Integrate over the normal random-intercept distribution to obtain a population-averaged rate.
  • Calculate marginal rates at two covariate exposure levels.
  • Derive when the population-averaged rate ratio equals the conditional rate ratio.
  • Distinguish changes in observation time from changes in the covariate being compared.
  • Check model assumptions and recognize when the simple rate-ratio result does not apply.

From Conditional Counts to Population-Averaged Rates

In a count study, the expected number of events depends both on the rate of events and on how long, or how much, each unit is observed. A patient observed for ten days can accumulate more events than a patient observed for one day even if their underlying rates are identical. A Poisson generalized linear mixed model separates this observation time from covariates that may change the rate, while a random intercept represents persistent differences among clusters.

The goal here is to compare the event rates for two values of a covariate across the population of clusters, rather than at one specified random-intercept value. The comparison requires integrating the conditional mean over the random-intercept distribution. In this particular log-link, random-intercept model, the integration has a closed form.

Model: For observation \(i\) in cluster \(j\), let \(Y_{ij}\) be the event count, \(T_{ij}>0\) the known observation time or other exposure amount, \(x_{ij}\) a covariate, and \(b_j\) a cluster-specific random intercept. Assume $$ Y_{ij}\mid b_j,x_{ij},T_{ij}\sim\operatorname{Poisson}(\mu_{ij}),\qquad \log(\mu_{ij})=\log(T_{ij})+\beta_0+\beta_1x_{ij}+b_j, \qquad b_j\sim N(0,\tau^2). $$ The random intercepts are assumed independent across clusters and independent of the covariates and observation times. The coefficient of \(\log(T_{ij})\) is fixed at one, so \(T_{ij}\) acts as an offset.

The model describes a conditional mean: given a cluster effect \(b_j\), the expected count is \(T_{ij}\exp(\beta_0+\beta_1x_{ij}+b_j)\). The conditional rate is that expected count divided by \(T_{ij}\). A population-averaged mean or rate instead averages over the distribution of \(b_j\). It describes the mean for a population of clusters represented by the assumed random-effects distribution, not the rate for a particular cluster whose effect is known.

Deriving the Marginal Rate

For a fixed covariate level \(x\) and exposure time \(T\), the marginal expected count is obtained by taking the expectation of the conditional mean over \(b\). The normal moment-generating function gives \(E[\exp(b)]=\exp(\tau^2/2)\) when \(b\sim N(0,\tau^2)\). Therefore,

$$ \begin{aligned} E(Y\mid x,T) &=E_b\{E(Y\mid b,x,T)\}\\ &=E_b\{T\exp(\beta_0+\beta_1x+b)\}\\ &=T\exp(\beta_0+\beta_1x)E_b\{\exp(b)\}\\ &=T\exp(\beta_0+\beta_1x+\tau^2/2). \end{aligned} $$

Dividing by the known exposure amount gives the population-averaged rate. The factor \(T\) cancels: changing observation time changes the expected count proportionally, but not the rate.

Result: Under the stated model, the population-averaged rate at covariate level \(x\) is $$ \lambda_{\mathrm{marg}}(x) =\frac{E(Y\mid x,T)}{T} =\exp(\beta_0+\beta_1x+\tau^2/2). $$ For two levels \(x_0\) and \(x_1\), with the same random-intercept distribution and the same covariate specification, $$ \mathrm{RR}_{\mathrm{marg}} =\frac{\lambda_{\mathrm{marg}}(x_1)}{\lambda_{\mathrm{marg}}(x_0)} =\exp\{\beta_1(x_1-x_0)\}. $$

Thus the random-intercept variance raises each marginal rate relative to the rate at \(b=0\), by the multiplier \(\exp(\tau^2/2)\). But that multiplier is common to both covariate levels and cancels in their rate ratio. This cancellation is specific to the stated model and comparison; it does not mean that random effects are irrelevant to marginal rates or to the model's dependence structure.

Worked Example: Integrating the Random Intercept

Suppose a hypothetical Poisson random-intercept model estimates \(\beta_0=-1.00\), \(\beta_1=0.35\) per dose unit, and \(\tau=0.60\). Find the population-averaged rate at dose \(x=0\), per unit of observation time.

The random-intercept variance is \(\tau^2=0.60^2=0.36\). The marginal rate formula gives $$ \lambda_{\mathrm{marg}}(0) =\exp\left(-1.00+0.35(0)+\frac{0.36}{2}\right) =\exp(-0.82) \approx 0.4404. $$

The model's rate units are events per unit of observation time. In this hypothetical setting, the estimated population-averaged rate at dose zero is approximately 0.4404 events per observation-time unit. At a cluster with \(b=0\), the conditional rate would instead be \(\exp(-1.00)=0.3679\). The marginal rate is higher because averaging \(\exp(b)\) is not the same as evaluating it at the mean \(b=0\).

Comparing Two Covariate Exposure Levels

A rate ratio compares rates, not expected counts. In the model above, \(\beta_1\) is the change in the conditional log rate for a one-unit increase in \(x\), holding the random intercept fixed. For a change from \(x_0\) to \(x_1\), exponentiating \(\beta_1(x_1-x_0)\) gives the multiplicative change in both the conditional and population-averaged rates. The rate difference, however, is on the original scale and depends on the baseline rate.

Worked Example: Marginal Rates and a Rate Ratio at Two Dose Levels

Use the hypothetical estimates \(\beta_0=-1.00\), \(\beta_1=0.35\), and \(\tau=0.60\). Compare dose \(x_0=0\) with dose \(x_1=2\). Calculate both marginal rates, their rate difference, and their population-averaged rate ratio.

The common random-effect adjustment is \(\tau^2/2=0.36/2=0.18\). At dose zero, $$ \lambda_{\mathrm{marg}}(0) =\exp(-1.00+0.35(0)+0.18) =\exp(-0.82) \approx 0.4404. $$ At dose two, $$ \lambda_{\mathrm{marg}}(2) =\exp(-1.00+0.35(2)+0.18) =\exp(-0.12) \approx 0.8869. $$

The rate difference is \(0.8869-0.4404=0.4465\) events per observation-time unit. The marginal rate ratio can be checked from the two rates, or derived directly: $$ \mathrm{RR}_{\mathrm{marg}} =\frac{0.8869}{0.4404} \approx 2.014, \qquad \exp\{0.35(2-0)\}=\exp(0.70)\approx 2.014. $$

Under the model, the population-averaged rate at dose two is about 2.014 times the rate at dose zero, a multiplicative increase of about 101.4%. This is an association described by the fitted model; it does not establish that changing dose causes a change in rate. The rate difference is about 0.4465 events per observation-time unit, and is not a 101.4% increase in the rate's units.

This calculation also shows why a rate ratio and a rate difference answer different questions. A common multiplicative comparison can be expressed without choosing an observation time. To convert a rate into an expected count, multiply by the relevant observation time. For example, the dose-two marginal expected count over four time units is \(4(0.8869)=3.548\), while over seven time units it is \(7(0.8869)=6.208\). These are counts, not rates.

Worked Example: Separating Dose From Observation Time

In the same hypothetical model, compare a cluster observed for four time units at dose \(x=0\) with one observed for seven time units at dose \(x=2\). Calculate their marginal expected counts and explain which comparison is the rate ratio across dose levels.

The first marginal rate is \(0.4404\) events per time unit, so its expected count is $$ E(Y\mid x=0,T=4)=4\exp(-0.82)\approx 4(0.4404)=1.762. $$ The second marginal rate is \(0.8869\) events per time unit, so its expected count is $$ E(Y\mid x=2,T=7)=7\exp(-0.12)\approx 7(0.8869)=6.208. $$

The ratio of these expected counts is approximately \(6.208/1.762=3.523\). It is not the dose rate ratio, because it includes the different observation times. The rate ratio is \(0.8869/0.4404\approx2.014\). Equivalently, divide each expected count by its own observation time before comparing. The observation-time ratio \(7/4=1.75\) explains the difference: \(1.75(2.014)\approx3.525\), with the small discrepancy due to rounding.

Assumptions, Diagnostics, and Scope

The integration and rate-ratio result rely on a clear set of assumptions. The conditional count distribution is Poisson with the stated mean; the log link is linear in the specified covariate and has a random intercept; the random intercept is normally distributed with mean zero and variance \(\tau^2\); and it is independent of the covariates and observation times. The offset must represent a meaningful, known exposure amount, and its coefficient must be one. For the simple rate ratio, the compared covariate levels must also share the same random-intercept distribution and the same relevant model structure.

These assumptions should be assessed rather than treated as automatic. Useful checks include comparing observed and fitted counts and rates across covariate levels and clusters, examining whether residual patterns suggest a missing nonlinear effect or interaction, and checking whether the model leaves substantial extra variation or an excess of zeros. A poor fit to the conditional mean can undermine both marginal rates. Likewise, if the covariate distribution differs systematically across clusters in a way related to \(b_j\), the assumed independence may be implausible and the simple population average may not represent the intended target.

The Poisson-lognormal mixture generally has more variability than a Poisson distribution with the same marginal mean. For a single observation, the model implies $$ \operatorname{Var}(Y\mid x,T) =E(Y\mid x,T)+\{E(Y\mid x,T)\}^2\{\exp(\tau^2)-1\}. $$ The second term is nonnegative and is positive when \(\tau^2>0\). Counts within a cluster are also associated through their shared random intercept. These features are part of why a random-intercept model can be more appropriate than a model that treats all counts as independent. They do not, by themselves, guarantee that the Poisson conditional distribution or normal random-effects distribution is adequate.

The formula for the rate ratio changes when the model structure changes. For example, with a random slope, the rate contrast can depend on the random-slope distribution and the covariate levels; with an interaction, the contrast depends on the values of the interacting covariates. If the coefficient of observation time is estimated rather than fixed at one, the model no longer imposes proportional growth of expected count with time, so dividing by \(T\) does not yield the same exposure-invariant rate formula. In these cases, the marginal rates must be derived from the actual fitted model and the intended population distribution.

The main alternatives target different structures or estimands. A Poisson GLM without random effects does not represent cluster heterogeneity through a random intercept. Generalized estimating equations target population-averaged relationships through a specified working correlation structure rather than by integrating a cluster-specific random-effects model. A conditional rate contrast fixes or conditions on a cluster effect; the marginal rate averages over the cluster distribution. In the simple model here, their rate ratios coincide, but their rates do not: the population-averaged rate includes \(\exp(\tau^2/2)\). For comparisons beyond this simple structure, distinguish the target population and model before interpreting a coefficient as a marginal contrast.

Common Mistakes

  • Using the conditional rate as the population rate. Setting \(b=0\) gives \(\exp(\beta_0+\beta_1x)\), not the marginal rate. Integration adds \(\tau^2/2\) to the log marginal rate.
  • Comparing counts when the question asks for rates. Expected counts also depend on observation time. Divide by each observation's exposure amount before comparing rates.
  • Adding the random-effect variance directly to the rate. The adjustment is multiplicative on the rate scale: the multiplier is \(\exp(\tau^2/2)\), not \(1+\tau^2/2\) as an exact identity.
  • Assuming the random-effect term always cancels. It cancels from the rate ratio only when the same random-intercept distribution applies at both compared covariate levels under this model.
  • Calling an observational rate ratio causal. A fitted association does not, by itself, show what would happen under an intervention on the covariate.
Key takeaway: With a Poisson log-link model, a known person-time offset, and a normal random intercept independent of the covariate, the marginal rate is \(\exp(\beta_0+\beta_1x+\tau^2/2)\). At two covariate levels, the common random-intercept multiplier cancels, giving the marginal rate ratio \(\exp\{\beta_1(x_1-x_0)\}\).

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. If \(\beta_0=-0.40\), \(\beta_1=0.20\), \(\tau=0.50\), and \(x=1\), what is the marginal rate per unit of observation time?
  2. For the model in question 1, calculate the marginal rate ratio comparing \(x=1\) with \(x=3\).
  3. Why is the ratio of expected counts for \(T=3,x=0\) and \(T=6,x=1\) not the rate ratio comparing \(x=0\) with \(x=1\)?
  4. State one assumption needed for the simple marginal rate ratio formula and one model change that could make that formula inapplicable.

Solutions. (1) The variance is \(0.50^2=0.25\), so the log marginal rate is \(-0.40+0.20(1)+0.25/2=-0.075\). The rate is \(\exp(-0.075)\approx0.9277\) events per time unit. (2) The rate ratio is \(\exp\{0.20(3-1)\}=\exp(0.40)\approx1.492\). (3) The expected counts include different observation times, three and six units; divide each expected count by its own time to compare rates. (4) One required assumption is that the same normal random-intercept distribution applies at both covariate levels and is independent of the covariate. A random slope, an interaction, or a freely estimated time coefficient can invalidate the simple formula as stated.

Clinical Biostats