Tutorials › Generalized Linear Mixed Models (GLMM) › Random Slopes With the Log Link

Random Intercepts and Slopes · Tutorial 48 of 698

Random Slopes With the Log Link

Translate cluster-specific slopes on the log scale into conditional response-mean ratios and percentage changes.

Intermediate 10 min read

What You'll Learn

  • Write a random-intercept-and-slope GLMM with a log link.
  • Derive the conditional mean ratio for a change in the predictor.
  • Convert a cluster-specific slope into a percentage change with units.
  • Distinguish cluster-specific effects from a single fixed-slope effect.
  • Recognize assumptions, diagnostics, and common interpretation errors.

Why a Random Slope Changes the Interpretation

With a log link, a slope describes a change in the logarithm of the conditional mean. Exponentiating that slope gives a multiplicative change in the mean, rather than an additive change. In a random-slope model, the slope itself differs by cluster. The result is a cluster-specific multiplicative change: for the same predictor change, one cluster’s conditional mean may increase more, increase less, or even decrease while another cluster’s mean increases.

The interpretation is conditional on the cluster’s random effects and on the other predictors in the model. It is not automatically an average effect across clusters. The key calculation is the ratio of two conditional means for the same cluster, with the predictor changed and other quantities held fixed.

Model and Assumptions

Definition: For observation \(i\) in cluster \(j\), let \(Y_{ij}\) have conditional mean \(\mu_{ij}\). A random-intercept-and-slope model with a log link is $$ \log(\mu_{ij})=\beta_0+\beta_1x_{ij}+b_{0j}+b_{1j}x_{ij}. $$ Here \(\beta_0\) and \(\beta_1\) are fixed effects, while \(b_{0j}\) and \(b_{1j}\) are cluster \(j\)'s random intercept and random slope deviations. Thus the cluster-specific intercept on the log scale is \(\beta_0+b_{0j}\), and the cluster-specific slope on the log scale is \(\beta_1+b_{1j}\). Equivalently, $$ \mu_{ij}=\exp\!\left(\beta_0+b_{0j}+(\beta_1+b_{1j})x_{ij}\right). $$

The response distribution must be appropriate for the outcome and support the specified conditional mean; for example, a Poisson model is commonly used for counts, while other response distributions may also be paired with a log link. The conditional mean must be positive. In a typical GLMM, observations are conditionally independent given the random effects and covariates, and the random effects follow a specified distribution, often a mean-zero bivariate normal distribution. The model also assumes that the stated fixed-effect and random-effect structure is an adequate description of how the conditional mean varies.

These distributional assumptions matter for fitting the model and for inference. The slope-to-ratio calculation below follows directly from the log-link mean equation; it does not require a particular random-effects distribution. When interpreting fitted cluster effects, however, remember that those effects are estimated quantities, not known constants.

Deriving the Conditional Multiplicative Change

Compare two predictor values, \(x\) and \(x+\Delta\), for the same cluster \(j\), with other predictors and exposure held fixed. The conditional means are

$$ \mu_j(x)=\exp\!\left(\beta_0+b_{0j}+(\beta_1+b_{1j})x\right) $$

and

$$ \mu_j(x+\Delta)=\exp\!\left(\beta_0+b_{0j}+(\beta_1+b_{1j})(x+\Delta)\right). $$

Dividing the second expression by the first cancels the intercept terms, including the cluster-specific random intercept. The remaining exponent is the cluster-specific slope multiplied by the predictor change:

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

This ratio is a conditional mean ratio. For a one-unit increase, set \(\Delta=1\), giving \(\exp(\beta_1+b_{1j})\). The corresponding percentage change is \(100[\exp(\beta_1+b_{1j})-1]\%\). For a change of \(\Delta\) units, use \(100[\exp((\beta_1+b_{1j})\Delta)-1]\%\). The percentage is relative to the original conditional mean, not an absolute change in response units.

If the predictor is measured in years, a one-unit increase means one year. If it is measured in tens of years, a one-unit increase means ten years. If the model includes an offset such as log exposure, comparisons with equal exposure have the same ratio because the offset cancels. Comparisons with different exposures require accounting for that difference.

Worked Example: A Positive Cluster-Specific Slope

Suppose a hypothetical Poisson GLMM models a cluster’s expected event count over equal observation periods. The predictor \(x\) is age in years, and the fitted fixed slope is \(\beta_1=0.08\). For one cluster, the estimated random slope deviation is \(b_{1j}=0.04\). Interpret a one-year and a three-year increase in age, conditional on this cluster.

The cluster-specific log-mean slope is $$ \beta_1+b_{1j}=0.08+0.04=0.12 $$ per year. For a one-year increase, the conditional mean ratio is $$ \exp(0.12)=1.1275. $$ Thus, within this cluster and for otherwise comparable observations, the conditional expected event count is about \(1.128\) times as large after a one-year increase in age. As a percentage change, $$ 100(1.1275-1)=12.75\%. $$ For a three-year increase, the ratio is $$ \exp(0.12\times3)=\exp(0.36)=1.4333. $$ The conditional expected count is therefore about \(1.433\) times as large, or \(43.33\%\) higher, for a three-year increase. It would be incorrect to multiply the one-year percentage increase by three: the log-link model compounds multiplicatively.

Worked Examples With Different Slopes and Scales

Worked Example: A Negative Slope Despite a Positive Fixed Effect

Consider a hypothetical log-link model in which \(x\) is a treatment duration measured in five-day units. The fixed slope is \(\beta_1=0.15\), and a particular cluster has \(b_{1j}=-0.25\). Calculate the conditional mean ratio for a one-unit increase and interpret a five-unit increase.

The cluster-specific slope is $$ \beta_1+b_{1j}=0.15-0.25=-0.10 $$ per five-day unit. For a one-unit increase, the ratio is $$ \exp(-0.10)=0.9048. $$ The conditional mean is \(0.9048\) times its former value, a decrease of $$ 100(0.9048-1)=-9.52\%. $$ A five-unit increase is a change of \(\Delta=5\), corresponding to 25 days. Its ratio is $$ \exp((-0.10)(5))=\exp(-0.50)=0.6065. $$ The conditional mean is about \(0.607\) times as large, or \(39.35\%\) lower. The positive fixed slope does not imply every cluster has a positive slope: this cluster’s random deviation is large enough to make its combined slope negative.

Worked Example: Comparing Two Clusters’ Multiplicative Changes

In a hypothetical model, \(x\) is measured in hours and the fixed slope is \(\beta_1=0.06\). Cluster A has \(b_{1A}=0.03\); cluster B has \(b_{1B}=-0.02\). Compare their conditional mean ratios for a two-hour increase, holding each cluster’s other conditions fixed.

For cluster A, the slope is \(0.06+0.03=0.09\) per hour, so the ratio for two hours is $$ \exp(0.09\times2)=\exp(0.18)=1.1972. $$ This is a \(19.72\%\) increase. For cluster B, the slope is \(0.06-0.02=0.04\) per hour, giving $$ \exp(0.04\times2)=\exp(0.08)=1.0833, $$ or an \(8.33\%\) increase. Both cluster-specific slopes are positive, but the conditional mean changes more rapidly in cluster A on the multiplicative scale. The comparison concerns within-cluster ratios; it does not say which cluster has the larger conditional mean at a particular hour, because their intercepts may differ.

What the Interpretation Does—and Does Not—Say

The exponentiated cluster-specific slope is a conditional ratio of means, not a difference in means. If the conditional mean is measured in events per observation period, the ratio itself has no units, while the predictor change must be reported with its units. To obtain an absolute difference, one would need the conditional mean at a starting predictor value: a ratio alone does not determine the number of events gained or lost.

The interpretation is also cluster-specific. The fixed slope \(\beta_1\) is the slope when the random slope deviation is zero; it does not describe every cluster when \(b_{1j}\) varies. Nor should \(\exp(\beta_1)\) automatically be described as the average ratio across clusters. Averaging conditional means over random effects is generally different from evaluating the mean equation at the average random effect.

A random-intercept model with no random slope sets \(b_{1j}=0\) for every cluster. It gives a common multiplicative predictor effect, \(\exp(\beta_1\Delta)\), while allowing cluster baselines to differ. A random-slope model allows that ratio to vary across clusters. In contrast, an identity-link model expresses slope changes as additive differences in the conditional mean, not multiplicative ratios. The link function therefore determines the scale on which a slope is directly additive and how it translates to the response scale.

Assumption Checks and Failure Modes

A numerical interpretation is meaningful only if the model provides a credible description of the data. Inspect whether the predictor varies within clusters; if it barely changes in many clusters, the data may provide little information about cluster-specific slopes. Check whether fitted conditional means follow the observed within-cluster pattern across the predictor range, and inspect conditional residuals for systematic structure. For count data, also check whether the chosen response distribution is compatible with the observed variability, rather than assuming that a log link alone resolves distributional mismatch.

Convergence warnings, unstable estimates, or extreme fitted conditional means can signal that the random-slope model is too complex for the available information or that the model is otherwise poorly specified. These are reasons to investigate the design, response distribution, predictor scale, and model fit—not reasons to interpret the estimated slopes mechanically. In particular, a large exponentiated slope can imply implausibly rapid growth over the observed predictor range.

  • Do not interpret the fixed slope as every cluster’s slope. Use \(\beta_1+b_{1j}\) for cluster \(j\).
  • Do not report the log-scale slope itself as a percentage. Exponentiate the slope times the predictor change, then subtract one and multiply by 100.
  • Do not ignore units. State what a one-unit or specified-unit change in \(x\) means.
  • Do not confuse a ratio with a difference. A ratio of 1.2 means a 20% increase, not an increase of 1.2 response units.
  • Do not generalize a conditional result automatically. The calculation concerns a given cluster’s conditional mean, not necessarily a population-average response.
Key takeaway: In a log-link random-slope model, cluster \(j\)'s slope is \(\beta_1+b_{1j}\). A predictor change of \(\Delta\) units multiplies that cluster’s conditional mean by \(\exp((\beta_1+b_{1j})\Delta)\). Convert the ratio to a percentage change only after exponentiating.

Check Your Understanding

For each question, calculate the requested conditional ratio before stating the interpretation. Solutions follow the questions.

  1. A cluster has \(\beta_1=0.04\) and \(b_{1j}=0.02\). What is the conditional mean ratio for a one-unit increase in \(x\), and what percentage change does it represent?
  2. A cluster-specific slope is \(-0.08\) per unit. Find the conditional mean ratio for a three-unit increase and interpret it as a percentage change.
  3. Suppose \(x\) is measured in months, \(\beta_1=0.10\), and \(b_{1j}=-0.15\). What is the ratio for a six-month increase? Explain why the fixed slope alone gives the wrong cluster-specific interpretation.
  4. In a random-intercept-and-slope model, why does the cluster-specific intercept cancel from the conditional mean ratio when comparing two values of \(x\) in the same cluster?

Solutions. (1) The cluster-specific slope is \(0.04+0.02=0.06\). The ratio is \(\exp(0.06)=1.0618\), so the conditional mean is about \(6.18\%\) higher for a one-unit increase. (2) The ratio is \(\exp((-0.08)(3))=\exp(-0.24)=0.7866\). The conditional mean is about \(21.34\%\) lower for a three-unit increase. (3) The cluster-specific slope is \(0.10-0.15=-0.05\) per month. For six months the ratio is \(\exp((-0.05)(6))=\exp(-0.30)=0.7408\), a decrease of about \(25.92\%\). The fixed slope omits this cluster’s random slope deviation and would not give its conditional effect. (4) The intercept terms are identical at both predictor values for the same cluster. Dividing the conditional means cancels \(\beta_0+b_{0j}\), leaving only \(\exp((\beta_1+b_{1j})\Delta)\).

Clinical Biostats