Tutorials › Generalized Linear Mixed Models (GLMM) › A Worked Count Random-Slope Interpretation

Random Intercepts and Slopes · Tutorial 62 of 698

A Worked Count Random-Slope Interpretation

Learn to translate a count-model random slope into cluster-specific rate ratios and expected event counts while keeping exposure and conditioning explicit.

Intermediate 12 min read

What You'll Learn

  • Write the conditional mean for a log-link count model with a random intercept, random slope and exposure offset.
  • Calculate a cluster-specific rate ratio for a one-unit or multi-unit covariate change.
  • Compute conditional expected counts from the model terms without introducing rounding errors.
  • Distinguish within-cluster rate changes from comparisons between clusters.
  • Recognize when a conditional interpretation is not a population-average interpretation.
  • Check exposure, scale, and model assumptions before interpreting results.

From a Random Slope to a Count-Scale Interpretation

In a log-link count model, a slope is expressed on the logarithmic scale. To describe a change in event rates, exponentiate the relevant slope. With a random slope, the slope for a particular cluster combines the population-level fixed slope with that cluster’s random-slope value. The resulting rate ratio can therefore differ across clusters.

Expected counts require one more piece of information: the exposure over which events are counted. A rate is an expected count per unit of exposure; an expected count over a specified exposure is the rate multiplied by that exposure. Keeping these quantities separate prevents a common interpretive error: treating a rate ratio as though it were itself an expected count.

Model and assumptions: For observation \(i\) in cluster \(j\), let \(Y_{ij}\) be a count, \(x_{ij}\) a quantitative predictor, and \(t_{ij}>0\) the exposure. A Poisson log-link random-intercept and random-slope model is $$ Y_{ij}\mid b_{0j},b_{1j}\sim\operatorname{Poisson}(\mu_{ij}),\qquad \log(\mu_{ij})=\log(t_{ij})+\beta_0+\beta_1x_{ij}+b_{0j}+b_{1j}x_{ij}. $$ Here \(\log(t_{ij})\) is an offset with coefficient fixed at 1; \(\beta_0,\beta_1\) are fixed effects; and \(b_{0j},b_{1j}\) are the cluster-specific random intercept and slope. Conditional on the random effects, the Poisson model has mean and variance \(\mu_{ij}\), and responses are assumed conditionally independent. The usual random-effects specification has \((b_{0j},b_{1j})\) drawn from a mean-zero bivariate normal distribution with a covariance matrix that allows the two effects to be associated. Interpretations below condition on specified random effects and assume the predictor and exposure are defined on the stated scales.

Dividing the conditional mean by exposure gives the cluster-specific conditional rate:

$$ \frac{\mu_{ij}}{t_{ij}}=\exp\{\beta_0+\beta_1x_{ij}+b_{0j}+b_{1j}x_{ij}\}. $$

At a fixed covariate value, the random intercept changes the cluster’s rate level. The random slope changes how that cluster’s rate responds to \(x\). The phrase conditional rate is important: this is the rate for the specified cluster effects, not an average over the random-effects distribution.

Why the Cluster-Specific Rate Ratio Has This Form

Compare two covariate values for the same cluster while holding exposure fixed. The conditional mean at \(x\) is \(t\exp\{\beta_0+\beta_1x+b_{0j}+b_{1j}x\}\). At \(x+1\), it is \(t\exp\{\beta_0+\beta_1(x+1)+b_{0j}+b_{1j}(x+1)\}\). Taking their ratio cancels the exposure and intercept terms.

$$ \frac{\mu_j(x+1)}{\mu_j(x)} = \exp\{\beta_1+b_{1j}\}. $$

This is also the ratio of conditional rates, provided the exposure is the same in the comparison. For a change of \(k\) units, the corresponding ratio is \(\exp\{k(\beta_1+b_{1j})\}\). Thus the fixed slope alone, \(\beta_1\), does not give the rate ratio for a particular cluster unless that cluster’s random slope is zero.

If exposure differs between the two observations, the ratio of expected counts includes the exposure ratio as well: \(\mu_j(x_2,t_2)/\mu_j(x_1,t_1)=(t_2/t_1)\exp\{(\beta_1+b_{1j})(x_2-x_1)\}\). The rate ratio still isolates the covariate effect, but the expected-count ratio does not.

Worked Example: Rate Ratio and Expected Count in One Cluster

Suppose a hypothetical event-count model has \(\beta_0=\log(2)\), \(\beta_1=0.20\), and for cluster A, \(b_{0A}=0.10\) and \(b_{1A}=0.15\). The predictor is \(x=3\), and the exposure is 4 hours. Calculate the cluster’s conditional rate, its expected count over 4 hours, and its rate ratio for a one-unit increase in \(x\).

The conditional log-rate, excluding the exposure offset, is \(\log(2)+0.20(3)+0.10+0.15(3)=\log(2)+1.15\). Therefore the rate is \(\exp\{\log(2)+1.15\}=2\exp(1.15)\approx6.31639\) events per hour.

Multiply the unrounded rate by the 4-hour exposure: \(\mu=4\exp\{\log(2)+0.20(3)+0.10+0.15(3)\}=4(6.3163858\ldots)\approx25.26554\). The conditional expected count is therefore about 25.27 events over 4 hours. An expected count need not be an integer.

For a one-unit increase in \(x\), the cluster-specific log-rate slope is \(\beta_1+b_{1A}=0.20+0.15=0.35\). The rate ratio is \(\exp(0.35)\approx1.41907\). In this model, and conditional on cluster A’s random effects, a one-unit increase in \(x\) corresponds to a rate about 1.419 times as large, or about 41.9% higher, at the same exposure. This is a model-based association, not a causal conclusion.

Interpreting Different Clusters

Cluster-specific slopes describe within-cluster changes as \(x\) changes. Comparing two clusters at the same \(x\) is a different calculation: both random intercepts and random slopes can matter. In particular, a cluster-specific rate ratio for a one-unit change depends on \(b_{1j}\), whereas a between-cluster rate ratio at a chosen \(x\) depends on both clusters’ intercept and slope deviations.

Worked Example: Comparing Two Cluster Trajectories

Consider a hypothetical model with \(\beta_0=\log(1.5)\) and \(\beta_1=0.30\). Cluster A has \(b_{0A}=0.05\), \(b_{1A}=-0.10\); cluster B has \(b_{0B}=-0.08\), \(b_{1B}=0.25\). At \(x=2\), calculate each conditional rate and the rate ratio for a one-unit increase in \(x\) within each cluster.

For cluster A, its conditional log-rate at \(x=2\), excluding exposure, is \(\log(1.5)+0.30(2)+0.05-0.10(2)=\log(1.5)+0.45\). Thus its rate is \(1.5\exp(0.45)\approx2.35247\) events per exposure unit. Its one-unit rate ratio is \(\exp(0.30-0.10)=\exp(0.20)\approx1.22140\).

For cluster B, the corresponding log-rate is \(\log(1.5)+0.30(2)-0.08+0.25(2)=\log(1.5)+1.02\). Its rate is \(1.5\exp(1.02)\approx4.15979\) events per exposure unit. Its one-unit rate ratio is \(\exp(0.30+0.25)=\exp(0.55)\approx1.73325\).

At \(x=2\), the rate ratio comparing B with A is \(\exp\{(-0.08-0.05)+(0.25-(-0.10))(2)\}=\exp(0.57)\approx1.76827\). This between-cluster comparison is not either cluster’s one-unit rate ratio. If both clusters instead had an exposure of 3 units, their expected counts would be \(3(2.352468\ldots)\approx7.05740\) and \(3(4.159792\ldots)\approx12.47938\). The expected-count ratio is the same as the rate ratio because the exposures are equal.

Expected Counts Require Exposure and a Covariate Value

Once the random effects and covariate value are specified, the expected count follows by substituting into the conditional-mean model. A count is not determined by the slope alone: it also depends on the fixed intercept, the random intercept, the covariate value, and exposure. The slope determines how the rate changes with \(x\), not its level by itself.

Worked Example: Expected Events Over a Stated Time

Suppose a hypothetical model for events per day has \(\beta_0=\log(0.8)\), \(\beta_1=0.12\), and for a specified cluster \(b_{0j}=0.20\), \(b_{1j}=-0.04\). For \(x=1\), find the expected number of events over 6 days and the one-unit rate ratio.

The conditional rate per day is \(\exp\{\log(0.8)+0.12(1)+0.20-0.04(1)\} =0.8\exp(0.28)\approx1.05850385\) events per day.

For 6 days, the expected count is calculated from the unrounded rate: \(\mu=6\exp\{\log(0.8)+0.12+0.20-0.04\}=6.3510231\ldots\). So the conditional expected count is about 6.351 events over 6 days. The one-unit rate ratio is \(\exp(0.12-0.04)=\exp(0.08)\approx1.08329\): a one-unit increase in \(x\) corresponds to an approximately 8.33% higher rate for this cluster, at equal exposure.

Assumptions, Diagnostics, and Alternatives

These calculations are valid interpretations of the specified model when its response, link, exposure, and random-effects structure are appropriate. The Poisson assumption says that, conditional on the random effects and predictors, the count mean equals its variance. Conditional independence says that no remaining dependence between observations is left after accounting for the modeled random effects and covariates. The offset assumption requires exposure to enter proportionally: doubling exposure doubles the conditional expected count, all else equal.

Before reporting a cluster-specific interpretation, check that the exposure is positive and measured in the stated units, that the predictor’s unit is clear, and that the chosen random-effect values are identified as the values being conditioned on. If the predictor was centered or rescaled, interpret a one-unit change on that model scale. A random slope’s interpretation does not automatically transfer to the original scale without accounting for the transformation.

  • Check fitted counts and residual patterns. Systematic discrepancies across fitted values or covariate ranges can indicate an inadequate mean structure. Excess variability beyond the conditional Poisson assumption can signal overdispersion; a random effect does not guarantee that all residual dispersion has been accounted for.
  • Check the slope variation and data support. A random-slope estimate based on little within-cluster variation in \(x\), sparse counts, or few clusters may be unstable. Cluster-specific rates at covariate values far outside observed ranges are extrapolations and can be especially sensitive.
  • Keep conditional and population-average quantities distinct. The rate ratio \(\exp(\beta_1+b_{1j})\) is conditional on the cluster’s random slope. Averaging predicted rates over the random-effects distribution is a different calculation; in general, it is not obtained merely by setting the random effects to zero.

A model with only a fixed slope would use \(\exp(\beta_1)\) as a common conditional rate ratio across clusters. That is a useful simpler alternative when slope variation is not part of the model, but it cannot represent cluster-specific responses. A model with random slopes allows that variation, while adding estimation demands and potentially less stable cluster-level predictions. A population-average analysis targets an average over clusters rather than a specified cluster’s conditional rate; it answers a different question and should not be substituted silently for this conditional interpretation.

Common pitfall: It is incorrect to report \(\exp(\beta_1)\) as the rate ratio for every cluster in a random-slope model. That omits \(b_{1j}\). For a specified cluster, use \(\exp(\beta_1+b_{1j})\). It is also incorrect to call this ratio an expected count: an expected count additionally requires a covariate value, the intercept terms, and a stated exposure.

Check Your Understanding

Answer each question, then check the solutions below.

  1. A cluster has \(\beta_1=0.18\) and \(b_{1j}=0.07\). What is its rate ratio for a two-unit increase in \(x\)?
  2. A cluster has conditional rate \(2.4\) events per hour at a specified \(x\). What is its expected count over 5 hours, assuming the rate remains constant over that exposure?
  3. Two observations from the same cluster differ by one unit in \(x\), but the second has twice the exposure. What is the ratio of their expected counts in terms of the cluster’s slope?
  4. Why is \(\exp(\beta_1)\) generally not the one-unit rate ratio for a specified cluster in a random-slope model?
  5. For two clusters at the same \(x\), identify which random effects can affect their rate ratio.

Solutions. (1) The cluster slope is \(0.18+0.07=0.25\), so the two-unit ratio is \(\exp\{2(0.25)\}=\exp(0.50)\approx1.649\). (2) The expected count is \(5(2.4)=12.0\) events. (3) If the cluster slope is \(\beta_1+b_{1j}\), the expected-count ratio is \(2\exp(\beta_1+b_{1j})\): the factor 2 is the exposure ratio. (4) The cluster’s random slope contributes to its conditional slope, so the relevant ratio is \(\exp(\beta_1+b_{1j})\). (5) Both clusters’ random intercepts and random slopes can affect the comparison; at the same \(x\), the rate ratio is \(\exp\{(b_{0B}-b_{0A})+(b_{1B}-b_{1A})x\}\).

Clinical Biostats