Why Separate the Predictor Into Two Parts?
In a generalized linear mixed model, the linear predictor for an observation depends on its covariates and, when the model includes a random intercept, on the cluster to which it belongs. Writing these contributions separately makes it clear which part is shared across observations in a cluster and which part can change with their covariate values. It also prevents a frequent error: using only the fixed-effects calculation when the question asks for a predictor conditional on a particular cluster’s random effect.
Here, \(j=1,\ldots,J\) indexes clusters and \(i=1,\ldots,n_j\) indexes observations within cluster \(j\). A cluster might be a clinic, school, or person with repeated observations. Let \(Y_{ij}\) be the response, \(\mathbf{x}_{ij}\) the fixed-effects covariate vector, and \(g\) the link function. The predictor is conditional because it is specified for a given value of the cluster’s random intercept.
Model and Assumptions
In a model with an explicit fixed intercept, the fixed-effects part can be written as \(\beta_0+\sum_{k=1}^{p}\beta_k x_{kij}\). Thus, for a given observation, the conditional predictor is
The fixed-effects component uses the specified covariate values and coefficients; it can differ between observations when their covariates differ. The random-intercept term is indexed by \(j\), not by \(i\): it has the same value for every observation in a given cluster. It can differ from one cluster to another. If the model contains an offset \(o_{ij}\), that known quantity is added to the predictor as well; it is not a random effect.
The usual random-intercept specification assumes \(b_j\) are independent across clusters and follow a normal distribution with mean zero and variance \(\tau^2\), written \(b_j\sim N(0,\tau^2)\). In the standard model, the random effects are also taken to be independent of the covariates. Conditional on the random effects and covariates, responses are independent and follow the chosen response distribution with the specified link and conditional mean. These assumptions are part of the model, not consequences of the predictor’s algebra.
The conditional predictor is not itself the conditional mean unless the link is the identity. With a non-identity link, it is the conditional mean after applying the link: \(g(\mu_{ij})=\eta_{ij}\). This tutorial focuses on identifying and calculating \(\eta_{ij}\), rather than converting it to the response scale.
Why the Decomposition Holds
A general mixed-model predictor can be expressed as a fixed-effects contribution plus a random-effects contribution, \(\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta}+\mathbf{z}_{ij}^{\mathsf T}\mathbf{b}\). For a random intercept alone, the random-effects design for observation \(i\) in cluster \(j\) is just the scalar \(z_{ij}=1\), and the relevant random-effect vector contains \(b_j\). Therefore its contribution is \(z_{ij}b_j=1\cdot b_j=b_j\). Substituting this into the general expression gives the random-intercept formula above. The fact that \(z_{ij}=1\) for every observation in cluster \(j\) is precisely why the random-effect contribution is shared within that cluster.
The zero mean in the distribution of \(b_j\) identifies the fixed intercept as the model’s average intercept on the linear-predictor scale across the assumed random-effects distribution. It does not mean that every cluster has \(b_j=0\). A particular cluster’s conditional predictor uses its particular \(b_j\), not the average value zero.
Worked Example: A Logistic Predictor for One Clinic
Suppose a hypothetical binary-outcome model for patients in clinics uses a logit link and has \(\beta_0=-1.2\), \(\beta_1=0.50\), and predictor \(x_{ij}\). The random intercept for clinic 4 is specified as \(b_4=-0.40\). Calculate the conditional linear predictor for a patient in clinic 4 with \(x_{i4}=2\).
The fixed-effects component is
Add the clinic-specific random intercept:
The conditional linear predictor for this patient, given the specified value of the clinic 4 random intercept, is \(-0.60\) on the logit scale. The clinic term is added once; it is not multiplied by the patient’s \(x\) value. The numerical value of the random intercept here is supplied for illustration, not estimated from real data.
Offsets and Cluster-Level Covariates
The same decomposition applies when the predictor includes an offset or a covariate that is constant within a cluster. An offset is a known, fixed contribution with its coefficient constrained to one. A cluster-level covariate is part of the fixed-effects calculation, even though it has the same value for each observation in a cluster. Neither should be mistaken for the random intercept.
Worked Example: Including an Offset in a Poisson Predictor
Consider a hypothetical Poisson GLMM with a log link, an exposure offset \(o_{ij}=\log(T_{ij})\), fixed intercept \(\beta_0=0.30\), fixed slope \(\beta_1=0.20\), and random intercept \(b_j\). For an observation in cluster 2, let exposure be \(T_{i2}=4\), \(x_{i2}=3\), and \(b_2=0.25\). Calculate its conditional predictor.
The offset is \(\log(4)\), approximately \(1.3863\). The fixed-effects part is \(0.30+(0.20)(3)=0.90\). Including the offset and cluster term gives
Thus the conditional linear predictor is approximately \(2.536\) on the log scale. Each contribution has a distinct role: \(\log(4)\) is the known offset, \(0.30+0.60\) is the fixed-effects contribution, and \(0.25\) is the cluster 2 random intercept. The example calculates the predictor only; it does not convert that value to a conditional mean.
Worked Example: One Random Intercept Shared by Two Observations
Suppose a hypothetical continuous-outcome model with an identity link has \(\beta_0=10\), \(\beta_1=2\), and cluster-level covariate \(w_j\) with coefficient \(\beta_2=-1\). The predictor is \(\eta_{ij}=\beta_0+\beta_1x_{ij}+\beta_2w_j+b_j\). In cluster 7, \(w_7=3\) and \(b_7=0.80\). Two observations have \(x_{17}=1\) and \(x_{27}=4\).
For the first observation, the fixed-effects contribution is \(10+(2)(1)+(-1)(3)=9\). Therefore,
For the second observation, the fixed-effects contribution is \(10+(2)(4)+(-1)(3)=15\). Therefore,
The fixed-effects contributions differ because \(x\) differs, while the cluster term is \(0.80\) in both calculations because both observations belong to cluster 7. The cluster-level covariate \(w_7\) also appears in both fixed-effects calculations, but it is not the random intercept.
Distinguishing the Main Approaches
A random-intercept GLMM is not the only way to represent clustered data. The approaches below differ in whether they include a cluster-specific term and in the kind of quantity they model. The key task here is to identify the conditional predictor specified by the random-intercept model, rather than to treat these alternatives as interchangeable.
| Approach | Cluster contribution to the predictor | Important distinction |
|---|---|---|
| Random-intercept GLMM | A shared random term \(b_j\) is added to the fixed-effects component. | The predictor is conditional on the cluster’s random effect. |
| Pooled GLM without a cluster term | No cluster-specific term is included. | It does not express the stated random-intercept structure. |
| Model with cluster indicators as fixed effects | Cluster-specific fixed parameters are included instead. | Those parameters are not the random intercepts in this model. |
A conditional predictor should also not be confused with a population-averaged prediction. The former is calculated at a specified value of \(b_j\); a population-averaged quantity accounts for the distribution of random effects rather than simply inserting one cluster’s value. With nonlinear links, these quantities generally do not coincide. Their comparison belongs to the broader distinction between conditional and marginal models.
Diagnostics, Common Mistakes, and Limits
The algebraic decomposition is simple, but it relies on using the right model terms and indices. When checking a calculation or a model specification, verify that each covariate is assigned to the intended observation or cluster, the offset is included when present, and the random intercept has the correct cluster index. For model assessment, systematic within-cluster patterns not represented by a common shift can signal that the random-intercept structure is inadequate. The assumed distribution of random effects can also be assessed using suitable diagnostics; an implausible distributional fit cautions against relying uncritically on the model.
- Omitting the random intercept: Calculating only \(\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta}\) gives the fixed-effects contribution, not the conditional predictor for a specified nonzero \(b_j\).
- Using an observation-specific random intercept: Writing \(b_{ij}\) changes the model. A random intercept is shared by all observations in cluster \(j\).
- Treating an offset as a random effect: An offset is known and enters with coefficient one; \(b_j\) is a cluster-specific model term.
- Replacing the cluster effect with its distributional mean: Setting \(b_j=0\) gives the predictor at the mean random-effect value, not the conditional predictor for a cluster whose specified value is nonzero.
The model is limited by its structure: one random intercept supplies a common shift on the link scale within each cluster. It does not allow the covariate slopes to vary among clusters. Whether this limitation matters depends on the application and should be considered when assessing fit. Also, in real analyses, the random effects are latent rather than directly observed; a supplied or estimated cluster value carries uncertainty and should not be treated as known without qualification.
Check Your Understanding
Answer each question, then compare with the brief solutions below.
- A model has predictor \(\eta_{ij}=1+0.4x_{ij}+b_j\). For an observation with \(x_{ij}=5\) in cluster 3 with \(b_3=-0.6\), calculate the conditional predictor.
- Two observations belong to cluster 8 but have different values of \(x\). Which part of a random-intercept model is necessarily shared between them?
- A Poisson model includes offset \(\log(T_{ij})\). Is this offset a fixed-effect coefficient to estimate, a random intercept, or a known predictor contribution?
- Why does setting \(b_j=0\) fail to calculate the conditional predictor for a cluster whose specified random-intercept value is \(0.35\)?
- Name one feature that a random-intercept model cannot represent through its cluster term alone.
Solutions. (1) The fixed-effects part is \(1+(0.4)(5)=3\), so \(\eta_{ij}=3-0.6=2.4\). (2) The cluster-specific random intercept \(b_8\) is shared; the fixed-effects contributions can differ if their covariates differ. (3) It is a known predictor contribution, included as the offset, not a random intercept or an estimated slope coefficient. (4) Zero gives the predictor at \(b_j=0\), whereas the specified cluster value contributes \(0.35\); the conditional predictor must include that value. (5) It cannot represent cluster-to-cluster variation in a covariate slope: its cluster term supplies a common shift on the link scale.