What a Subject-Specific Mean Model Specifies
In clustered or repeated-measures data, observations from the same person, clinic, school, or other unit may be related. A generalized linear mixed model (GLMM) represents this structure by modeling the response mean conditional on random effects. Those random effects describe how a particular cluster or individual departs from the fixed, shared part of the model. The resulting conditional mean is often called a subject-specific mean.
Let \(Y_{ij}\) be the response for observation \(j\) in cluster \(i\). Let \(\mathbf{x}_{ij}\) be the covariate vector for fixed effects and \(\mathbf{z}_{ij}\) the covariate vector for random effects. The fixed-effect coefficient vector is \(\boldsymbol{\beta}\), and the cluster-specific random-effect vector is \(\mathbf{b}_i\). The model connects the conditional response mean to a linear predictor through a link function.
The same model structure can be paired with different response distributions and links. For example, a Bernoulli response commonly uses a logit link, while a count response commonly uses a log link. A random intercept is a random effect included for every observation in a cluster. A random slope lets the effect of a covariate vary across clusters. These are model components, not extra observed predictors: \(\mathbf{b}_i\) is latent.
Assumptions Behind the Conditional Mean
The equation for the mean is only one part of a GLMM. To specify a probability model, also state the conditional response distribution and the random-effects distribution. A common setup is that, given \(\mathbf{b}_i\) and the covariates, the responses follow a chosen distribution from the exponential-family model class and are conditionally independent within and across clusters. For binary outcomes, for instance, each conditional response may be Bernoulli with mean \(\mu_{ij}(\mathbf{b}_i)\). For counts, it may be Poisson with that conditional mean.
A standard random-effects assumption is that cluster effects are independent draws from a distribution with mean zero and covariance matrix \(\mathbf{D}\), often a multivariate normal distribution. The zero mean anchors the shared fixed-effect part: the random effects describe deviations around it. The covariance matrix specifies the variability of those deviations and, when there is more than one random effect, their associations. A typical specification is \(\mathbf{b}_i\sim N(\mathbf{0},\mathbf{D})\). This distributional assumption does not make the responses marginally independent within a cluster; dependence arises because observations share \(\mathbf{b}_i\).
The covariates are usually treated as given for this conditional model, and the random effects are assumed to have the stated distribution rather than a systematic dependence on those covariates. These assumptions need substantive consideration. If, for example, clusters with large values of a covariate also tend to have systematically different unmodeled random effects, a simple independent random-effects specification may not represent the data-generating structure well.
Worked Example: Conditional Probability for a Cluster
Suppose a hypothetical binary-outcome model uses a logit link and a random intercept: $$ \operatorname{logit}(\mu_{ij}(b_i)) = -1.0+0.8\,T_{ij}+0.6\,A_{ij}+b_i. $$ Here \(T_{ij}\) is an indicator for a treatment condition, \(A_{ij}\) is age centered at a chosen reference age and measured in years, and \(b_i\) is the cluster-specific random intercept. Consider a cluster with \(b_i=0.4\) and an individual with \(T_{ij}=1\) and \(A_{ij}=1\).
First substitute the values into the linear predictor: $$ \eta_{ij}=-1.0+0.8(1)+0.6(1)+0.4=0.8. $$ For the logit link, the conditional mean is the inverse-logit of this value: $$ \mu_{ij}(0.4)=\frac{\exp(0.8)}{1+\exp(0.8)} =\frac{2.226}{1+2.226} =0.690. $$ Thus the model assigns a conditional response probability of about 0.690 for an individual with these covariates in a cluster whose random intercept is 0.4. This is not the probability averaged over the distribution of clusters.
The coefficient 0.8 contributes to the conditional log odds for a one-unit change in \(T_{ij}\), with the other covariates and \(b_i\) held fixed. On the odds scale, the corresponding conditional multiplier is \(\exp(0.8)=2.226\). This statement concerns the model conditional on the specified random effect; it does not, by itself, describe an average comparison across the population of clusters.
Random Intercepts, Slopes, and Conditional Predictions
A random intercept shifts the linear predictor for every observation in the same cluster. A random slope changes the cluster-specific contribution of a predictor as that predictor changes. For example, with time as a predictor, a model might use a random intercept \(b_{0i}\) and a random time slope \(b_{1i}\): $$ g(\mu_{ij}(\mathbf{b}_i)) = \beta_0+\beta_1 t_{ij}+b_{0i}+b_{1i}t_{ij}. $$ The fixed slope \(\beta_1\) is the shared component of the linear predictor's time relationship; the cluster-specific component also includes \(b_{1i}\). The random intercept and slope may be correlated, as represented by their covariance matrix. A random slope should be included only when the design and data can support estimating the variation it introduces.
Worked Example: A Cluster-Specific Time Pattern
Consider a hypothetical logistic model $$ \operatorname{logit}(\mu_{ij}) = -0.5+0.4t_{ij}+b_{0i}+b_{1i}t_{ij}. $$ For one cluster, suppose \(b_{0i}=0.3\) and \(b_{1i}=-0.2\). At time \(t_{ij}=2\), the conditional linear predictor is $$ \eta_{ij}=-0.5+0.4(2)+0.3+(-0.2)(2)=0.2. $$ Therefore the conditional probability is $$ \mu_{ij}=\frac{\exp(0.2)}{1+\exp(0.2)} =\frac{1.221}{2.221}=0.550. $$ For this cluster, the time coefficient in the conditional linear predictor is \(0.4-0.2=0.2\), not \(0.4\) alone. The fixed slope is shared across clusters, while the random slope represents this cluster's departure from it.
This calculation assumes the model's logit-linear time pattern is appropriate and that the specified random effects are the values being conditioned on. In practice, the random effects are not directly observed; estimates for a particular cluster carry uncertainty and are informed by the model and that cluster's data.
An offset can also enter a conditional linear predictor when the mean is a rate multiplied by known exposure. For a log-link count model, adding the log of exposure makes the conditional expected count proportional to exposure while the remaining linear predictor describes the rate. The next example separates the expected count from the expected rate.
Worked Example: Expected Count With an Exposure Offset
Suppose a hypothetical Poisson GLMM for event counts has the form $$ \log(\mu_{ij}(b_i)) = -2.0+0.3x_{ij}+b_i+\log(E_{ij}), $$ where \(E_{ij}\) is exposure measured in person-years, \(x_{ij}\) is a predictor, and \(b_i\) is a random intercept. For \(x_{ij}=2\), \(b_i=0.2\), and exposure \(E_{ij}=3\) person-years, substitute: $$ \log(\mu_{ij})=-2.0+0.3(2)+0.2+\log(3) =-1.2+1.099=-0.101. $$ Exponentiating gives the conditional expected count: $$ \mu_{ij}=\exp(-0.101)=0.904\text{ events}. $$ The conditional expected rate is the expected count divided by exposure: $$ \frac{0.904}{3}=0.301\text{ events per person-year}. $$ Equivalently, after removing the offset, that rate is \(\exp(-2.0+0.3(2)+0.2)=\exp(-1.2)=0.301\). The rate is conditional on the specified random intercept and predictor value.
Why Conditional and Population Means Differ
A subject-specific mean answers a conditional question: what mean does the model assign for a specified covariate pattern and specified random effect? A population-averaged mean instead averages over the random-effects distribution. In general, that average is not obtained by simply setting the random effect to zero. The reason is that applying a nonlinear inverse link and averaging do not generally commute.
The marginal mean implied by the model is defined by integrating the conditional mean over the random-effects distribution: $$ E(Y_{ij}\mid \mathbf{x}_{ij},\mathbf{z}_{ij}) = \int g^{-1}\!\left(\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta} +\mathbf{z}_{ij}^{\mathsf T}\mathbf{b}\right) \,dF_{\mathbf{b}}(\mathbf{b}). $$ By contrast, setting \(\mathbf{b}=\mathbf{0}\) gives \(g^{-1}(\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta})\), the conditional mean at the average random-effect value. These are different operations. The integral depends on the random-effects distribution as well as on the link and fixed effects. This distinction is central when deciding whether the scientific question is about a particular cluster or about the population average.
A Short Justification: Shared Effects Induce Dependence
Conditional independence given the random effects does not imply marginal independence. To see why, take two responses \(Y_{ij}\) and \(Y_{ik}\) in the same cluster. The law of total covariance gives $$ \operatorname{Cov}(Y_{ij},Y_{ik}) = E\!\left[\operatorname{Cov}(Y_{ij},Y_{ik}\mid \mathbf{b}_i)\right] + \operatorname{Cov}\!\left(E[Y_{ij}\mid\mathbf{b}_i],E[Y_{ik}\mid\mathbf{b}_i]\right). $$ If the responses are conditionally independent, the first term is zero. The second term remains because both conditional means depend on the same random effects. Thus $$ \operatorname{Cov}(Y_{ij},Y_{ik}) = \operatorname{Cov}\!\left(\mu_{ij}(\mathbf{b}_i),\mu_{ik}(\mathbf{b}_i)\right), $$ which is generally nonzero. A random intercept that raises the conditional mean for all observations in a cluster will commonly create positive within-cluster association. The GLMM therefore specifies both a conditional mean structure and a mechanism for dependence through shared latent effects.
Diagnostics, Alternatives, and Limitations
A conditional mean model can fail even when its link and response distribution are familiar. Check whether the chosen link and predictor form are plausible, whether exposure or offsets are defined correctly, and whether the random-effects structure fits the scientific design. For example, a systematic trend in residuals over time can signal a missing nonlinear time pattern; extreme clusters that the fitted random-effects distribution cannot represent may indicate a distributional or structural mismatch. For count models, remaining variation beyond what the specified response and random effects explain can also flag a poor fit.
Diagnostics for GLMMs require care because the random effects are latent. A cluster's estimated random effect is not a directly measured cluster characteristic, and estimates are typically pulled toward the distribution's center, especially when a cluster has little information. Inspecting those estimates alone is not a complete model check. Also consider whether there are enough independent clusters to estimate the random-effects variation reliably, whether a random-slope variance is effectively near zero, and whether the data support the added complexity.
A generalized linear model (GLM) without random effects is a simpler alternative when the observations are appropriately independent or their dependence is otherwise addressed. A generalized estimating equation (GEE) is an alternative framework for population-averaged modeling. These approaches address different targets and assumptions; they are not interchangeable merely because they use the same response distribution or link. A GLMM is useful when cluster-specific variation and conditional predictions are substantively important, but its conclusions depend on the specified random-effects distribution and conditional model.
- Pitfall: treating \(b_i=0\) as the population average. Zero is the mean random effect under the usual centered specification, but the inverse link of the fixed predictor is generally not the average of inverse-link predictions across random effects.
- Pitfall: calling a fixed slope every cluster's slope. With a random slope, a cluster's conditional slope includes both the fixed slope and its random-slope contribution.
- Pitfall: interpreting conditional independence as no within-cluster association. Responses may be independent after conditioning on \(\mathbf{b}_i\) and still be associated after those latent effects are averaged out.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A logistic random-intercept model has linear predictor \(-0.4+0.5x+b_i\). For \(x=1\) and \(b_i=0.2\), calculate the conditional probability.
- In a log-link model with a random intercept and a random slope for time, what part of the conditional time slope varies across clusters?
- Why can two responses be associated marginally even if they are conditionally independent given the cluster random effect?
- Does setting a random effect to zero generally produce the population-averaged mean? Explain.
Solutions. (1) The linear predictor is \(-0.4+0.5(1)+0.2=0.3\), so the conditional probability is \(\exp(0.3)/(1+\exp(0.3))=1.350/2.350=0.574\). (2) The cluster-specific random-slope contribution is added to the fixed time coefficient; thus the conditional slope is the fixed slope plus that cluster's random slope. (3) Both conditional means depend on the shared random effect, so their covariance across the random-effects distribution can be nonzero. (4) No. Setting the random effect to zero gives a conditional mean at that value; the population-averaged mean integrates the inverse-link prediction over the random-effects distribution.