Tutorials › Generalized Linear Mixed Models (GLMM) › Dependence Between Observations Sharing a Crossed Unit

Crossed and Nested Random Effects · Tutorial 507 of 698

Dependence Between Observations Sharing a Crossed Unit

Learn how a shared crossed random effect induces dependence, and calculate the resulting response correlation for Gaussian and Poisson-lognormal models.

Advanced 12 min read

What You'll Learn

  • Derive covariance for two observations sharing one crossed classification.
  • Calculate the Gaussian response correlation from variance components.
  • Obtain Poisson-lognormal covariance and correlation on the response scale.
  • Distinguish response-scale correlation from latent-scale correlation.
  • Identify assumptions and diagnostics relevant to shared-unit dependence.

Why a Shared Crossed Unit Creates Dependence

In a crossed design, each observation belongs to a unit from each of two classifications. For example, a response might be recorded for a particular subject and item, or for a particular target and rater. Two observations can involve the same unit from one classification while involving different units from the other. Even if the observations are independent after conditioning on all random effects, they can be dependent marginally because they share one random effect.

The focus here is a pair \(Y_{ij}\) and \(Y_{ik}\): both observations involve unit \(i\) from classification A, but \(j\ne k\), so they involve different units from classification B. The correlation depends on the model and response distribution. In a Gaussian random-intercept model, it is a simple variance-component ratio. In a generalized linear mixed model with a nonlinear link, the response-scale correlation generally requires integrating over the random effects.

Definition: The shared-unit covariance for a pair of responses is their marginal covariance when they share a unit from one crossed classification but not the other. Their marginal correlation is \(\operatorname{Corr}(Y_{ij},Y_{ik})=\operatorname{Cov}(Y_{ij},Y_{ik})/\sqrt{\operatorname{Var}(Y_{ij})\operatorname{Var}(Y_{ik})}\). “Marginal” means that the random effects have been averaged over, rather than held fixed.

Model and Assumptions

First consider a Gaussian crossed random-intercept model with an identity link:

$$ Y_{ij}=\mathbf{x}_{ij}^{\mathsf T}\boldsymbol{\beta}+a_i+b_j+\varepsilon_{ij}. $$

Assume \(a_i\sim N(0,\sigma_A^2)\), \(b_j\sim N(0,\sigma_B^2)\), and \(\varepsilon_{ij}\sim N(0,\sigma^2)\). The A effects, B effects, and residuals are mutually independent, and residuals are independent across observations. The fixed-effect term is treated as nonrandom. These assumptions imply conditional independence of distinct responses given the random effects. For the pair \(Y_{ij},Y_{ik}\), the residuals and the B effects differ, while \(a_i\) is shared.

The same dependence logic applies to a GLMM with a non-Gaussian response: assume conditional independence of the response observations given all random effects, and let \(\mu_{ij}(a_i,b_j)=E(Y_{ij}\mid a_i,b_j)\) denote a conditional mean. If \(Y_{ij}\) and \(Y_{ik}\) are conditionally independent, their marginal covariance is the covariance of their conditional means. This is the key step for nonlinear-link models.

Result: Under conditional independence, \(\operatorname{Cov}(Y_{ij},Y_{ik})=\operatorname{Cov}\{\mu_{ij}(a_i,b_j),\mu_{ik}(a_i,b_k)\}\). The two conditional means can be dependent marginally because they both depend on \(a_i\). The result requires that there is no additional conditional residual covariance between the two responses.

Gaussian Shared-Unit Correlation

For the Gaussian model, subtracting the fixed means leaves \(a_i+b_j+\varepsilon_{ij}\) and \(a_i+b_k+\varepsilon_{ik}\). Independence makes every cross-product expectation zero except the contribution from the shared \(a_i\). Thus the covariance is \(\sigma_A^2\). Each response has variance \(\sigma_A^2+\sigma_B^2+\sigma^2\), so the correlation is:

$$ \operatorname{Cov}(Y_{ij},Y_{ik})=\sigma_A^2,\qquad \operatorname{Corr}(Y_{ij},Y_{ik}) =\frac{\sigma_A^2}{\sigma_A^2+\sigma_B^2+\sigma^2}, \quad j\ne k. $$

This expression assumes the same variance components for both observations. It does not depend on their fixed-effect means: adding constants changes neither covariance nor variance. The denominator includes variation from both crossed classifications and the observation-level residual. The numerator includes only the component shared by this pair.

Worked Example: Gaussian Responses Sharing a Subject

Suppose a hypothetical experiment records a continuous score for subjects on multiple items. Use the Gaussian crossed random-intercept model, with subject variance \(\sigma_A^2=0.36\) score-squared units, item variance \(\sigma_B^2=0.25\) score-squared units, and residual variance \(\sigma^2=0.64\) score-squared units. Calculate the correlation for two scores from the same subject on two different items.

The pair shares the subject effect, so its covariance is \(0.36\) score-squared units. Each score has marginal variance \(0.36+0.25+0.64=1.25\) score-squared units. Therefore,

$$ \operatorname{Corr}(Y_{ij},Y_{ik}) =\frac{0.36}{\sqrt{1.25(1.25)}} =\frac{0.36}{1.25} =0.288,\qquad j\ne k. $$

The model-implied marginal correlation is 0.288. This describes positive association between scores from the same subject, after averaging over subject and item effects; it is not a causal effect of being the same subject. The calculation relies on independent item effects and residuals for the two observations, in addition to the shared subject effect.

Non-Gaussian Responses: The Poisson-Lognormal Case

For a nonlinear link, the shared variance component is not generally the response covariance. Consider a crossed Poisson-lognormal random-intercept model:

$$ Y_{ij}\mid a_i,b_j\sim\operatorname{Poisson}(\lambda_{ij}\exp(a_i+b_j)), \qquad a_i\sim N(0,\sigma_A^2),\quad b_j\sim N(0,\sigma_B^2). $$

Here \(\lambda_{ij}\) is a positive fixed-effect mean factor, and the random effects are independent across classifications and units. Conditional on them, responses are independent. The marginal mean is \(m_{ij}=\lambda_{ij}\exp\{(\sigma_A^2+\sigma_B^2)/2\}\). For two observations sharing A but having independent B effects, their conditional means share the factor \(\exp(a_i)\). Since a normal variable \(a_i\) has \(E\{\exp(a_i)\}=\exp(\sigma_A^2/2)\) and \(E\{\exp(2a_i)\}=\exp(2\sigma_A^2)\), the covariance of those means is \(m_{ij}m_{ik}\{\exp(\sigma_A^2)-1\}\).

The marginal variance of one response includes Poisson sampling variation as well as variation in its random mean:

$$ \operatorname{Var}(Y_{ij}) =m_{ij}+m_{ij}^2\{\exp(\sigma_A^2+\sigma_B^2)-1\}. $$

The first term is the conditional Poisson variance averaged over the random effects; the second is the variance of the conditional mean. Consequently the pairwise response correlation is the covariance above divided by the square root of the two marginal variances. Unlike the Gaussian case, it depends on the marginal means as well as the random-effect variances.

Worked Example: Poisson Counts Sharing One Crossed Unit

Suppose a hypothetical count model has two observations from the same subject on different items. Their equal marginal means are \(m=2.455050\) counts. Let the subject random-intercept variance be \(\sigma_A^2=0.25\) and the item random-intercept variance be \(\sigma_B^2=0.16\), on the log-mean scale. Find the marginal covariance and correlation.

The pairwise covariance is \(\operatorname{Cov}(Y_{ij},Y_{ik})=m^2\{\exp(0.25)-1\}\). Substituting the values gives

$$ (2.455050)^2\{\exp(0.25)-1\} =6.0272705(0.2840254) \approx 1.711898 \approx 1.712\ \text{counts}^2. $$

For either observation, the total random-effect variance on the log scale is \(0.25+0.16=0.41\). Its marginal variance is therefore

$$ 2.455050+ (2.455050)^2\{\exp(0.41)-1\} =2.455050+6.0272705(0.5068178) \approx 5.50978\ \text{counts}^2. $$

Because the two marginal variances are equal, their correlation is \[ \frac{1.711898}{\sqrt{5.50978(5.50978)}} =\frac{1.711898}{5.50978} \approx 0.3107. \] Thus the model implies a positive response-scale correlation of about 0.311 between counts sharing a subject but coming from different items. The Poisson sampling variation in the denominator is why this correlation is not simply a ratio of random-effect variances.

Worked Example: Unequal Marginal Means

In a second hypothetical Poisson-lognormal setting, two counts share an A unit but have different B units and different marginal means: \(m_{ij}=2\) counts and \(m_{ik}=4\) counts. Let \(\sigma_A^2=0.09\) and \(\sigma_B^2=0.16\). Calculate their covariance and correlation.

The shared-A covariance is \[ (2)(4)\{\exp(0.09)-1\} =8(0.0941743) \approx 0.753394\ \text{counts}^2. \] The two marginal variances use the same total random-effect variance, \(0.09+0.16=0.25\):

$$ \operatorname{Var}(Y_{ij}) =2+2^2\{\exp(0.25)-1\} =2+4(0.2840254) \approx 3.13610, $$
$$ \operatorname{Var}(Y_{ik}) =4+4^2\{\exp(0.25)-1\} =4+16(0.2840254) \approx 8.54441. $$

The correlation is \[ \frac{0.753394}{\sqrt{(3.13610)(8.54441)}} \approx \frac{0.753394}{5.1765} \approx 0.1455. \] Although the shared-A covariance is positive, the pair has a smaller correlation than in the equal-mean example. Both the covariance and the two marginal variances matter; covariance alone does not determine correlation.

Interpretation, Diagnostics, and Alternatives

A useful check is to state exactly which unit is shared. In the Gaussian example, observations sharing A have covariance \(\sigma_A^2\); observations sharing B instead have covariance \(\sigma_B^2\), under the same independence assumptions. If a pair shares neither unit, its covariance is zero in this random-intercept model. These statements concern the model-implied marginal dependence, not necessarily the empirical correlation in a finite sample.

For a logistic GLMM, a commonly used latent-scale summary adds a logistic residual variance of \(\pi^2/3\) to the denominator. That yields a correlation summary on an assumed latent scale, not the observed binary-response correlation. The observed response correlation depends on the fixed predictors and on integration over the random effects. It should be obtained from the fitted model’s implied joint probabilities or another appropriate marginal calculation. The same caution applies to other non-Gaussian families: a variance-component fraction is not automatically the response-scale correlation.

Diagnostics should check whether the assumed dependence pattern is plausible. Compare observed response similarity for pairs sharing A with similarity for pairs sharing B or neither, while accounting for the response type and fixed predictors. Inspect conditional or simulated residual patterns for remaining clustering, and check whether the fitted variance component is near zero or is poorly determined. Sparse crossing, a small number of units, or strong imbalance can make these checks imprecise. Persistent dependence among pairs sharing neither unit can indicate omitted clustering or residual dependence; treating it as explained by the shared-A effect would be a model error.

The main alternative is to report variance components or a latent-scale intraclass correlation rather than a response-scale pair correlation. Variance components describe the model’s sources of variation; a response-scale correlation directly describes the association for a specified kind of pair, but may depend on its predictor values. A model with an explicit residual correlation or additional shared effects may be needed if conditional independence is not credible. These approaches answer different questions, and none repairs a design that does not contain enough replication to distinguish the relevant variance components.

Common pitfall: It is incorrect to say that the correlation for observations sharing A is always \(\sigma_A^2/(\sigma_A^2+\sigma_B^2+\sigma^2)\). That ratio applies to the stated Gaussian identity-link model with homogeneous independent residuals. For a Poisson-lognormal model, for example, the shared-A covariance is \(m_{ij}m_{ik}\{\exp(\sigma_A^2)-1\}\), and the marginal variances also contain Poisson variation. Derive the response covariance and variances for the actual model before forming the correlation.
1
Identify shared membership.
Specify which crossed unit the pair shares and verify that the other classification units differ.
2
Find the marginal covariance.
Use the Gaussian variance-component result when its assumptions hold; otherwise take the covariance of the conditional means under conditional independence.
3
Standardize on the response scale.
Calculate both marginal variances and divide the covariance by their geometric mean. Keep the response scale and units explicit.

Check Your Understanding

Answer each question, then compare with the short solutions.

  1. In a Gaussian crossed random-intercept model, what is the covariance of two observations sharing A but not B?
  2. For Gaussian data, let \(\sigma_A^2=0.20\), \(\sigma_B^2=0.30\), and \(\sigma^2=0.50\). What is the shared-A correlation?
  3. Why does conditional independence not imply marginal independence for two responses sharing A?
  4. In the Poisson-lognormal model, which terms determine the shared-A covariance for a pair with unequal marginal means?
  5. Why is a logistic latent-scale correlation not automatically the observed binary-response correlation?

Solutions. (1) It is \(\sigma_A^2\), because only the A random intercept is shared. (2) The marginal variance is \(0.20+0.30+0.50=1.00\), so the correlation is \(0.20/1.00=0.200\). (3) Both conditional means depend on the same random effect \(a_i\), so averaging over \(a_i\) induces covariance between them. (4) The covariance is \(m_{ij}m_{ik}\{\exp(\sigma_A^2)-1\}\); it depends on both marginal means and the shared random-effect variance. (5) A latent-scale correlation is defined for an unobserved response scale; the observed binary correlation depends on the fixed predictors and integration over the random effects.

Clinical Biostats