One Slope Per Cluster
A random slope allows the relationship between a predictor and the response to differ across clusters. The key word is across: in the usual random-slope model, each cluster has its own slope, and that slope is used for all observations in that cluster. It is not a new slope drawn separately for every record.
This distinction matters when interpreting conditional predictions. Two records in the same cluster can have different predicted responses because their predictor values differ, but their random-slope coefficient is the same. Differences in their observed outcomes can also arise from the response distribution; those differences do not, by themselves, imply different slopes.
A common specification assumes that the cluster effects are independent across clusters and have a bivariate normal distribution:
The random effects describe variation in cluster-specific intercepts and slopes around the fixed effects. The response distribution is chosen for the outcome, and observations are assumed conditionally independent given their covariates and cluster random effects. For example, a count model may use a Poisson conditional distribution with a log link; a binary-outcome model may use a Bernoulli conditional distribution with a logit link. The examples below use specified random-effect values only to show how predictions are calculated; they are not estimates from real data.
How the Shared Slope Enters Predictions
For a given cluster \(j\), the total slope on the link scale is \(\beta_1+b_{1j}\). The fixed slope \(\beta_1\) is common to the population model; \(b_{1j}\) shifts that slope for cluster \(j\). Thus, when \(x\) increases by one unit within that cluster, the linear predictor changes by \(\beta_1+b_{1j}\), holding other predictors fixed. The link function then maps that linear predictor to a conditional mean or probability.
The record index \(i\) appears on \(x_{ij}\) and \(Y_{ij}\), because records can have different predictor and response values. It does not appear on \(b_{1j}\): that effect is indexed by cluster. This indexing is not merely notation. It expresses the model’s assumption that records in the same cluster share the same latent slope.
Worked Example: A Shared Slope in a Count Model
Suppose hypothetical counts are modeled with a Poisson distribution and a log link. For illustration, let \(\beta_0=1.2\), \(\beta_1=0.3\), and suppose a particular cluster has \(b_{0j}=-0.2\) and \(b_{1j}=0.4\). Consider records in that cluster with \(x_{ij}=0,1,2\). The conditional mean is \(\mu_{ij}=\exp(\eta_{ij})\), where $$ \eta_{ij}=1.2+0.3x_{ij}-0.2+0.4x_{ij}=1.0+0.7x_{ij}. $$
At \(x=0\), \(\eta=1.0+0.7(0)=1.0\), so the conditional mean count is \(\exp(1.0)=2.718\). At \(x=1\), \(\eta=1.0+0.7(1)=1.7\), giving \(\exp(1.7)=5.474\). At \(x=2\), \(\eta=1.0+0.7(2)=2.4\), giving \(\exp(2.4)=11.02\).
The same \(b_{1j}=0.4\) was used for all three records. For a one-unit increase in \(x\), this cluster’s conditional mean is multiplied by \(\exp(\beta_1+b_{1j})=\exp(0.7)=2.014\), with the other model terms held fixed. The three observed counts need not be these means: each is a random response conditional on its mean. That response variation does not create a separate slope for each record.
Why the Cluster Index Matters
The shared coefficient has a direct algebraic consequence. For two observations \(i\) and \(k\) in cluster \(j\), the random-effect contribution to their linear predictors is \(b_{0j}+b_{1j}x_{ij}\) and \(b_{0j}+b_{1j}x_{kj}\). Subtracting one from the other gives:
The random intercept cancels, while the same random slope multiplies the difference in predictor values. This shows how one cluster-level slope shapes the conditional trajectory over all records in that cluster. It does not say that the observed responses must lie on a straight line: the equation concerns the linear predictor, and the response distribution still allows variation around the conditional mean.
Worked Example: Comparing Two Records in One Cluster
In a hypothetical logit-link model, suppose \(\beta_0=-1.0\), \(\beta_1=0.5\), and a cluster has \(b_{0j}=0.2\), \(b_{1j}=-0.3\). Its conditional linear predictor is $$ \eta_{ij}=-1.0+0.5x_{ij}+0.2-0.3x_{ij}=-0.8+0.2x_{ij}. $$ The conditional probability is \(p_{ij}=1/(1+\exp(-\eta_{ij}))\).
For a record with \(x=0\), \(\eta=-0.8\), so \(p=1/(1+\exp(0.8))=0.3100\). For a record with \(x=2\), \(\eta=-0.8+0.2(2)=-0.4\), so \(p=1/(1+\exp(0.4))=0.4013\). Both calculations use the same cluster effects, including \(b_{1j}=-0.3\).
The difference in linear predictors is \(-0.4-(-0.8)=0.4\). The subtraction formula gives the same result: \(b_{1j}(2-0)=-0.3(2)=-0.6\) for the random-effect part, while the fixed slope contributes \(\beta_1(2-0)=1.0\). Together, \(1.0-0.6=0.4\). The conditional probabilities differ because the predictor values differ, not because these two records received different random slopes.
Different Clusters, Different Slopes
A random slope permits the total slope to vary from cluster to cluster. To see the contrast, keep the fixed effects in the preceding logistic example but suppose another cluster has \(b_{0k}=0.2\) and \(b_{1k}=0.2\). Its total slope is \(0.5+0.2=0.7\), whereas the first cluster’s total slope is \(0.5-0.3=0.2\). The second cluster’s slope is steeper on the log-odds scale. Within either cluster, however, every record uses that cluster’s one slope.
The shared random effect also induces a connection among conditional predictions for records in the same cluster: changing the cluster’s slope changes the linear predictors of all its records, with the size and direction of the change depending on their \(x\) values. This is one reason a random slope is a cluster-level model component rather than a label for arbitrary record-to-record fluctuation.
Worked Example: One Cluster Effect, Several Predictor Values
Consider a hypothetical log-link model with fixed slope \(\beta_1=0.2\). A cluster has random slope \(b_{1j}=0.5\), so its total slope on the log-mean scale is \(0.2+0.5=0.7\). For two records in this cluster, \(x_{ij}=1\) and \(x_{kj}=3\), the random-slope contributions are \(0.5(1)=0.5\) and \(0.5(3)=1.5\). These contributions differ because the predictor values differ; the coefficient multiplying them remains \(0.5\).
The change in the random-slope contribution between the records is \(1.5-0.5=1.0\), which also follows from \(b_{1j}(3-1)=0.5(2)=1.0\). Including the fixed slope, the total change in the linear predictor is \((\beta_1+b_{1j})(3-1)=0.7(2)=1.4\). Under the log link, the corresponding ratio of conditional means is \(\exp(1.4)=4.055\), holding other terms fixed.
If a third record in the same cluster had \(x=4\), the coefficient would still be \(0.5\); its random-slope contribution would be \(0.5(4)=2.0\). The value \(2.0\) is a contribution to that record’s linear predictor, not a new random slope.
Assumptions, Diagnostics, and Alternatives
The interpretation above relies on the model’s structure: the cluster membership is correctly defined; the predictor and link are specified as intended; one random-slope value applies to every record in a cluster; and the distribution of the cluster effects is an adequate representation of between-cluster variation. The conditional response distribution and its assumed dependence structure must also be suitable. In particular, a random slope does not automatically handle dependence left over after conditioning on the included random effects.
Useful checks focus on whether the fitted structure is plausible and supported by the data. Examine the observed predictor range and the number of clusters with meaningful within-cluster variation in \(x\). If most clusters have only one observed predictor value, their within-cluster slope information is limited. Plot conditional fitted trajectories by cluster alongside the data, using the same estimated cluster effect across all points in each trajectory. Look for systematic patterns the specified model does not capture, while remembering that scattered binary outcomes or counts around a fitted trajectory are expected under their response distributions.
Convergence warnings, a random-slope variance estimated near zero, or a poorly determined intercept-slope covariance can indicate that the data do not support the chosen random-effects structure. These are prompts to investigate, not automatic proof that the model is wrong. A model with too few clusters or too little within-cluster predictor variation may estimate cluster-to-cluster slope variation imprecisely. Predictions based on fitted random effects also have uncertainty; treating illustrative or estimated values as known without qualification can make conditional predictions seem more certain than they are.
| Approach | What varies | Interpretation |
|---|---|---|
| Fixed slope only | One slope for all clusters | Cluster trajectories share the same slope, though they may have different intercepts if a random intercept is included. |
| Cluster-level random slope | One slope deviation per cluster | All records within a cluster share that cluster’s slope deviation. |
| Observation-specific slope | A separate slope deviation per record | This is a different model for record-level heterogeneity, not the usual cluster-level random slope. |
The fixed-slope model is a simpler alternative when slope variation across clusters is not supported or is not part of the scientific question. A cluster-level random slope is appropriate when the relationship is expected to vary across clusters and the data contain enough information to estimate that variation. Giving each observation its own slope instead changes the model’s meaning and dependence structure; it should not be done merely because observed outcomes differ from their conditional means.
A Common Misinterpretation
A reliable reading check is to ask which index labels the random effect. In \(b_{1j}\), the cluster index \(j\) means one value is attached to a cluster. In \(b_{1ij}\), both the cluster and record indices appear, which would describe a different, observation-specific effect. The latter is not what is meant by the standard cluster-level random slope.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- In a random-slope model, what does the index \(j\) in \(b_{1j}\) tell you?
- For two records in the same cluster, explain why their random-slope contributions can differ even though their random slope is shared.
- A colleague says that different observed outcomes in one cluster require a different random slope for every record. Identify the error in that reasoning.
- In a log-link model, a cluster’s total slope is \(0.6\). What is the ratio of conditional means for a one-unit increase in \(x\), holding other terms fixed?
Solutions. (1) The slope deviation is indexed by cluster, so one value \(b_{1j}\) is used for all records in cluster \(j\). (2) The contribution is \(b_{1j}x_{ij}\); different \(x_{ij}\) values produce different contributions even with the same coefficient. (3) It confuses response variation around a conditional mean with slope variation. The random slope describes a cluster-specific relationship, while observed outcomes also vary according to the response distribution. (4) The ratio is \(\exp(0.6)=1.822\), so the conditional mean is multiplied by about 1.822 for a one-unit increase in \(x\), under the stated log-link model.