Two Ways to Represent Clustered Outcomes
A GLMM and GEE can both account for dependence among observations in the same cluster, but they do so in different ways. A GLMM introduces latent random effects and specifies a probability distribution for them. GEE instead specifies a marginal mean model and a working covariance for the observations within a cluster. The distinction matters: a GLMM’s parameters generally describe outcomes conditional on the latent effects, whereas GEE’s mean parameters describe population-average outcomes.
These approaches make different commitments, not simply different computational choices. In particular, specifying a GLMM random-effects distribution affects how conditional predictions are averaged across clusters. GEE does not require a random-effects distribution, but its estimating equations still depend on a mean model and a working covariance. A robust sandwich variance can reduce dependence on the working covariance for inference about mean parameters; it cannot make a wrong mean model correct.
What the Random-Effects Distribution Assumes
For a GLMM, let \(Y_{ij}\) denote the response for observation \(j\) in cluster \(i\), and let \(x_{ij}\) and \(z_{ij}\) be the corresponding fixed-effect and random-effect design vectors. A typical conditional mean model is
Here \(g\) is the link function, \(\beta\) is the fixed-effect parameter vector, and \(D\) is the random-effects covariance matrix. The normal distribution is a commonly used assumption, not a consequence of having clustered data. The model also specifies a conditional response distribution, such as a distribution from the exponential family, and often assumes observations are conditionally independent within a cluster given \(b_i\) and the covariates.
The normality assumption concerns the distribution of the latent effects across clusters. It does not say that the observed outcomes are normally distributed. For example, a GLMM can have a binary conditional response with a logit link and normally distributed random intercepts. The random-effects distribution is used when integrating the conditional response model to obtain a marginal distribution or marginal mean.
A random-effects distribution should be plausible for the scientific setting and adequate for the inferential goal. A normal random intercept permits effects above and below the population mean, with the amount of variation controlled by its variance. It may be unsuitable if the latent effects are strongly skewed, have a few distinct subpopulations, or have heavier tails than the normal distribution. Even when its mean and variance seem reasonable, a distribution’s shape can matter because nonlinear links do not generally preserve averages.
Worked Example: Stating a Random-Intercept Model
Suppose a hypothetical study records a continuous outcome in \(K\) clinics, with two measurements per patient. A proposed model uses a patient-level random intercept. State the assumptions and the interpretation of its fixed treatment coefficient.
Let \(Y_{ij}\) be the outcome for patient \(i\) at measurement \(j\), and let \(T_{ij}\) indicate treatment. One possible model is
This specification assumes that patient intercepts are normally distributed with mean zero and variance \(\tau^2\); conditional on the intercept and treatment, the response has a normal distribution with variance \(\sigma^2\). It also assumes conditional independence of the measurements given the patient intercept and covariates. For this model to describe independent patients, their random intercepts must be independent across patients. If patients are clustered within clinics in a way that induces additional dependence, the stated model may not capture that dependence.
Because the identity link is linear, \(\beta_1\) is the conditional mean difference, in outcome units, between treatment values 1 and 0 at the same value of \(b_i\). In this particular model, averaging over \(b_i\) gives the same mean difference. That equality is not guaranteed for a nonlinear link.
Why Distribution Shape Can Affect Marginal Interpretation
Let the conditional mean be \(m(x,b)=E(Y\mid x,b)\). The marginal mean is obtained by averaging over the random-effects distribution:
The distribution \(f_B\) therefore helps determine the marginal mean. For a linear conditional mean, averaging may leave the fixed-effect relationship unchanged when the random effects have mean zero. For a nonlinear link, the average of the inverse-linked conditional means is generally not the inverse link evaluated at the average linear predictor. Consequently, a GLMM’s conditional coefficient need not equal the corresponding population-average effect, and the marginal relationship can depend on the assumed random-effects distribution.
The following calculation isolates the role of distribution shape. It uses a conditional logistic mean purely to illustrate integration; it does not require treating the marginal mean as another logistic curve.
Worked Example: Same Random-Effects Variance, Different Marginal Probability
Consider the hypothetical conditional mean \(P(Y=1\mid x,b)=\operatorname{expit}(x+b)\), where \(\operatorname{expit}(u)=1/(1+e^{-u})\). At \(x=1\), compare two symmetric distributions for \(b\). Distribution A puts probability \(1/2\) at each of \(-1\) and \(1\). Distribution B puts probability \(1/2\) at 0 and probability \(1/4\) at each of \(-\sqrt{2}\) and \(\sqrt{2}\).
Both distributions have mean zero. Distribution A has variance \(\{(-1)^2+(1)^2\}/2=1\); distribution B has variance \((1/2)(0^2)+(1/4)(\sqrt{2})^2+(1/4)(-\sqrt{2})^2=1\). Thus they have the same mean and variance but different shapes.
Under Distribution A, the marginal probability is
Under Distribution B, it is
The marginal probabilities differ by about 0.0041 despite the matching random-effects means and variances. This example does not show that the difference must be large; it shows that the distribution’s shape can affect marginal predictions under a nonlinear link. In a real analysis, the impact depends on the link, the covariates, and the spread and shape of the latent effects.
GEE: A Working Covariance, Not a Latent Distribution
For GEE, the starting point is a marginal mean model, often written \(E(Y_i)=\mu_i(\beta)\). A working covariance \(V_i\) represents the variance and within-cluster association used to form the estimating equations. For independent clusters, a common form of the estimating equation is
The working covariance is a device for weighting residual information across observations. It may use an independence, exchangeable, AR(1), or unstructured working correlation, for example. These structures do not assert that a particular latent variable follows a particular distribution. In general, GEE uses the marginal mean and selected covariance moments rather than a fully specified joint probability model.
This does not mean GEE makes no assumptions. The marginal mean model must be appropriate for the target parameter; clusters must be independent for the usual cluster-robust variance argument; and the data and estimating equations must meet suitable regularity and moment conditions. The working covariance must also be usable in the estimating equations. A misspecified working correlation can reduce efficiency, and too few independent clusters can make the usual sandwich approximation unreliable.
When the marginal mean model is correct, the estimating equation can remain unbiased even if the working correlation is not the true correlation. The sandwich variance estimates uncertainty using the observed cluster-level score contributions rather than relying solely on the working covariance being correct. This is robustness to covariance misspecification—not robustness to every kind of model error.
Worked Example: A GEE Mean and Sandwich Standard Error
Suppose a hypothetical continuous outcome is measured twice in each of four independent clusters. The observed values are \((2,4)\), \((3,5)\), \((4,6)\), and \((5,7)\). Fit an intercept-only marginal mean model and use an exchangeable working correlation of \(\rho=0.5\), with working variance scale \(\sigma^2=1\). These data are illustrative; four clusters are too few to rely on the usual large-cluster approximation for final inference.
For each cluster, the sample mean is \(3,4,5,\) and \(6\), so the overall mean is \(18/4=4.5\). To verify that it solves the GEE, write \(D_i=\mathbf{1}\), a two-element vector. With \(V_i=R\) and exchangeable \(R\), \(R^{-1}\mathbf{1}=\mathbf{1}/(1+\rho)=\mathbf{1}/1.5\). The intercept estimating equation is therefore proportional to the sum of all residuals, and its solution is \(\hat\beta_0=4.5\).
The cluster residual vectors are \((-2.5,-0.5)\), \((-1.5,0.5)\), \((-0.5,1.5)\), and \((0.5,2.5)\). Their sums are \(-3,-1,1,\) and \(3\). The sensitivity term is \(A=\sum_iD_i^{\mathsf T}V_i^{-1}D_i=8/1.5=5.333\). Each cluster score is its residual sum divided by 1.5, so the meat of the sandwich is
Thus the uncorrected sandwich variance and standard error are
The estimate is 4.5 outcome units, and the robust standard error is 0.5590 outcome units. The estimate happens to be the same under other working correlations here because the clusters have equal size and the model has only an intercept. That special feature should not be generalized to unequal cluster sizes or more complicated mean models.
What Robustness Does—and Does Not—Provide
The sandwich variance has the form \(A^{-1}BA^{-1}\): \(A\) reflects how the estimating equation changes with the parameters, while \(B\) summarizes variation in cluster-level scores. Its key practical purpose is to protect large-sample standard errors against a wrong working covariance, provided the marginal mean model is correct and the independent-cluster and regularity conditions are credible.
The sandwich does not repair a misspecified marginal mean, dependent clusters treated as independent, or an inadequate number of independent clusters. It also does not turn GEE into a full probability model for individual clusters. Conversely, a GLMM’s likelihood uses its specified random-effects and conditional response distributions. If those distributions are poorly chosen, likelihood-based estimates, uncertainty, or predictions may be affected. The extent of the effect depends on the model and estimand; it is not correct to claim that every departure from normal random effects necessarily invalidates every fixed-effect estimate.
Diagnostics, Alternatives, and Limitations
For a GLMM, inspect whether the assumed random-effects structure is plausible for the design and whether fitted conditional and marginal patterns are compatible with the data. Examine cluster-level residual patterns and the distribution of estimated random effects, while remembering that estimated effects are shrunken and are not direct observations of the latent distribution. Sensitivity analyses using plausible alternative random-effects distributions or structures can show whether conclusions depend on the assumed shape. Such comparisons do not prove which distribution is true.
For GEE, inspect residual and empirical within-cluster association patterns, assess whether the mean model fits the scientific question, and consider whether the chosen working correlation is numerically stable. Compare estimates and standard errors under reasonable working correlations. Similar estimates with differing standard errors can be consistent with a robust mean estimate and efficiency differences; strongly changing estimates may signal unequal weighting or other sensitivity that deserves investigation. A large-cluster sandwich approximation should not be treated as reliable merely because software reports it.
The main alternative is not simply “normal random effects versus a different correlation.” GLMM and GEE generally target different parameterizations: conditional effects given latent effects versus marginal effects in the population. A GLMM can be useful when cluster-specific interpretation or conditional prediction is central and its distributional assumptions are defensible. GEE is useful for marginal mean estimation without specifying a latent-effect distribution, while requiring enough independent clusters for reliable robust inference. Neither approach is universally robust or automatically preferable.
Common Mistake
Wrong reasoning: “GEE uses a sandwich standard error, so the GEE analysis is robust even if its mean model is wrong.” The sandwich addresses uncertainty from a potentially misspecified working covariance; it does not remove bias from a wrong mean model. Likewise, calling a GLMM robust because its random effects are normal confuses a modeling assumption with a protection against misspecification. State which part of the model is assumed and which kind of departure a method can tolerate.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- In a GLMM, what does the assumption \(b_i\sim N(0,D)\) describe? Does it assert that the observed outcomes are normally distributed?
- Why can two random-effects distributions with the same mean and variance still produce different marginal means under a nonlinear link?
- What is GEE’s working covariance for, and what does the sandwich variance protect against?
- A GEE uses an incorrect working correlation but a correct marginal mean model and many independent clusters. Which part of the inference may be affected, and why?
- Give one reason a robust sandwich variance might still be unreliable in a GEE analysis.
Solutions. (1) It describes the assumed distribution of latent effects across clusters, not the distribution of observed outcomes; the conditional response distribution is specified separately. (2) A nonlinear inverse link does not generally commute with averaging, so the marginal mean depends on more than the random effects’ first two moments. (3) The working covariance weights residual information in the estimating equations; the sandwich provides large-sample variance protection against covariance misspecification when the mean model is correct. (4) Efficiency and model-based standard errors may be affected; the sandwich can still give valid large-sample variance under the stated conditions. (5) Too few independent clusters, dependence between clusters, a wrong mean model, or failure of relevant regularity and moment conditions can undermine the usual argument.