Tutorials › Generalized Linear Mixed Models (GLMM) › Crossed Subjects and Items in Experiments

Crossed and Nested Random Effects · Tutorial 498 of 698

Crossed Subjects and Items in Experiments

Specify crossed subject-and-item random effects and trace the dependence they create in repeated-response experiments.

Advanced 10 min read

What You'll Learn

  • Write a GLMM with separate random intercepts for subjects and items.
  • Distinguish crossed from nested and fully crossed from partially crossed designs.
  • Identify which pairs of responses share a subject effect, an item effect, or both.
  • Derive covariance for a Gaussian crossed-intercept model and explain dependence for non-Gaussian outcomes.
  • Recognize design and modeling limitations that can undermine interpretation.

Why Subjects and Items Both Matter

In many experiments, each subject responds to several items, and each item is presented to several subjects. Responses from one subject may be related because that subject has a characteristic tendency to respond high or low. Responses to one item may also be related because some items are intrinsically easier, harder, or more likely to elicit a particular response. A model that accounts for only one source can leave the other source of dependence unrepresented.

This structure occurs, for example, when participants judge sentences, answer test questions, or classify images. The subjects and items are crossed when a subject can respond to multiple items and an item can be answered by multiple subjects. They are not nested merely because each individual response belongs to one subject and one item: nesting would mean that each item belongs to only one subject, or vice versa.

Definition: In a subject-by-item response design, let \(Y_{si}\) denote the response from subject \(s\) to item \(i\). A crossed random-intercept GLMM specifies the conditional distribution of \(Y_{si}\) given subject and item random effects, with a linear predictor of the form $$ g\{E(Y_{si}\mid b_s,u_i)\} = \mathbf{x}_{si}^{\mathsf T}\boldsymbol{\beta}+b_s+u_i. $$ Here \(g\) is the link function, \(\mathbf{x}_{si}\) is the predictor vector, \(\boldsymbol{\beta}\) is the fixed-effect coefficient vector, \(b_s\) is the subject random intercept, and \(u_i\) is the item random intercept.

A standard specification assumes \(b_s\sim N(0,\tau_S^2)\) independently across subjects and \(u_i\sim N(0,\tau_I^2)\) independently across items, with the subject and item effects mutually independent. Given all random effects and the predictors, responses are assumed conditionally independent and to follow the chosen response distribution, such as Bernoulli for a binary outcome or Gaussian for a continuous outcome. The distribution, link, and conditional variance must suit the outcome. Random effects are generally taken to be independent of the predictors; the interpretation of them as population variation also depends on the subjects and items being reasonably viewed as sampled from populations of interest.

The random intercepts represent unexplained baseline differences, not causal effects. Fixed predictors may include an experimental condition or other measured covariates. In this model, a fixed-effect coefficient describes a change in the linear predictor conditional on the random effects. The earlier material on crossed random intercepts gives the general covariance logic; here the focus is how it maps onto the subject-and-item design.

Writing the Model and Reading Its Structure

The same subject effect appears in every response from that subject; the same item effect appears in every response to that item. Thus two different responses can share neither effect, one of them, or both. The indices make those shared memberships explicit. When a particular subject-item pair has one response, use \(Y_{si}\). If there are several trials per pair, an additional trial index can be added, but this random-intercept model alone does not guarantee that repeated trials are conditionally independent for every scientific purpose.

A design is fully crossed if every subject responds to every item. It is partially crossed if some subject-item combinations are absent, while subjects and items still recur across the design. Both designs can have crossed random effects. The crucial question for the model is which subject and item memberships each observed response has, not whether the full rectangular table is complete.

Worked Example: A Binary Response From a Subject and an Item

Suppose a hypothetical experiment records whether each response is correct. A logistic crossed-intercept model is $$ \operatorname{logit}\{P(Y_{si}=1\mid b_s,u_i)\} =\beta_0+\beta_1 x_{si}+b_s+u_i, $$ where \(x_{si}=1\) denotes a practice condition and \(x_{si}=0\) denotes a comparison condition. Let \(\beta_0=-0.80\), \(\beta_1=0.60\), and suppose the particular subject and item have \(b_s=0.20\) and \(u_i=-0.30\). Calculate the conditional probability of a correct response in the practice condition.

Substitute \(x_{si}=1\): $$ \eta_{si}=-0.80+(0.60)(1)+0.20-0.30=-0.30. $$ The inverse-logit transformation gives $$ P(Y_{si}=1\mid b_s,u_i,x_{si}=1) =\frac{\exp(-0.30)}{1+\exp(-0.30)} =\frac{0.7408}{1.7408} \approx 0.4256. $$ For this subject-item combination, the model assigns a conditional probability of about 42.56% to a correct response. This is conditional on the specified random effects; it is not the population-average probability across subjects and items.

The random effects have not changed the fixed coefficient \(\beta_1\). Rather, they shift this particular response's log odds through the subject's and item's baselines. Under the logistic link, the conditional odds ratio for the practice indicator is \(\exp(0.60)\approx1.822\), holding the random effects fixed.

How Shared Membership Creates Dependence

The random effects induce dependence because they are common to multiple responses. A derivation is clearest for a Gaussian identity-link version of the model. Suppose $$ Y_{si}=\mathbf{x}_{si}^{\mathsf T}\boldsymbol{\beta}+b_s+u_i+\varepsilon_{si}, $$ where \(b_s\), \(u_i\), and \(\varepsilon_{si}\) are mutually independent, have means zero, and have variances \(\tau_S^2\), \(\tau_I^2\), and \(\sigma^2\), respectively. Residuals are independent across distinct observations. For two distinct responses, fixed predictors contribute no covariance, so the covariance is determined by the random effects they share.

1
Responses share a subject only.
The common term \(b_s\) contributes \(\operatorname{Var}(b_s)=\tau_S^2\). The item effects and residuals are independent across the two responses, so they contribute zero covariance.
2
Responses share an item only.
The common term \(u_i\) contributes \(\operatorname{Var}(u_i)=\tau_I^2\). Distinct subjects have independent subject effects, and distinct observations have independent residuals.
3
Responses share both.
Both \(b_s\) and \(u_i\) are common, so their variances add. If these are distinct replicate observations for the same pair, their residual covariance is zero under the stated assumptions.

In compact form, the covariance between two distinct observations is \(\tau_S^2\) if they share only a subject, \(\tau_I^2\) if they share only an item, \(\tau_S^2+\tau_I^2\) if they share both, and zero if they share neither. The variance of a single observation is \(\tau_S^2+\tau_I^2+\sigma^2\). These expressions depend on the stated independence assumptions; a different residual structure would change them.

For a non-Gaussian GLMM, the same shared-effect mechanism applies, but the Gaussian covariance formula on the response scale generally does not. Let \(m_a\) and \(m_b\) be the conditional means of two responses given all random effects. Conditional independence gives $$ \operatorname{Cov}(Y_a,Y_b) =E\{\operatorname{Cov}(Y_a,Y_b\mid\text{random effects})\} +\operatorname{Cov}(m_a,m_b) =\operatorname{Cov}(m_a,m_b). $$ The shared random effects influence both conditional means. With a nonlinear link, their response-scale covariance is generally not simply a sum of variance components. In particular, the latent linear-predictor covariance should not be reported as if it were the response-scale covariance for binary data.

Worked Example: Covariance for Three Sharing Patterns

For a hypothetical continuous-response experiment, suppose the subject, item, and residual variances are \(\tau_S^2=0.49\), \(\tau_I^2=0.16\), and \(\sigma^2=0.36\), in squared response units. The marginal variance of one response is $$ \operatorname{Var}(Y_{si})=0.49+0.16+0.36=1.01. $$ Calculate the covariance and correlation for each pair of distinct responses below.

Same subject, different items. The covariance is \(0.49\), since only the subject intercept is shared. The correlation is $$ \frac{0.49}{\sqrt{1.01(1.01)}}=\frac{0.49}{1.01}\approx0.4851. $$

Different subjects, same item. The covariance is \(0.16\), and the correlation is $$ \frac{0.16}{1.01}\approx0.1584. $$

Same subject and same item, distinct replicate responses. Both intercepts are shared, so the covariance is \(0.49+0.16=0.65\), and the correlation is $$ \frac{0.65}{1.01}\approx0.6436. $$ All covariances are in squared response units; correlations are unitless. The calculations show why the same pair of people or items does not describe all response relationships: the membership pattern determines which components are shared.

Partially Crossed Experimental Schedules

Incomplete schedules do not automatically make subject and item effects nested. The following hypothetical design has four subjects and three items, but not every possible pair is observed.

SubjectItems answeredNumber of observed responses
S1A, B, C3
S2A, B2
S3B, C2
S4A, C2

Worked Example: Recognizing Partial Crossing

Use the schedule above to determine whether subject and item effects are crossed, and identify the shared memberships for selected response pairs.

Every subject answers more than one item, and every item is answered by more than one subject: A is answered by S1, S2, and S4; B by S1, S2, and S3; C by S1, S3, and S4. Thus subjects and items are crossed. The design is not fully crossed because, for example, S2 does not answer C. A model can still assign a subject random intercept to each subject and an item random intercept to each item.

The responses from S1 to A and S1 to B share S1 but not an item. The responses from S1 to A and S2 to A share item A but not a subject. Responses from S1 to A and S2 to B share neither. These relationships identify the covariance components each pair can inform under a Gaussian model. Whether the available pattern provides enough information to estimate all components well must be assessed from the actual design and data; crossing by itself does not guarantee precise or identifiable estimates.

Assumptions, Diagnostics, and Alternatives

Before interpreting a fitted model, check that its structure matches the experiment. Subject and item identifiers must refer to the same units wherever those units recur; assigning a new item identifier each time an item is presented would erase its shared-item structure. Confirm from the schedule that responses actually share subjects and items as specified. The response distribution and link should be suitable, and the random-intercept distribution and conditional-independence assumptions should be plausible enough for the intended analysis.

Useful checks include examining response patterns by subject and by item, verifying that each modeled grouping factor has replication, and checking for influential subjects or items and poor model fit. For binary outcomes, compare observed and model-predicted response patterns across subjects, items, and relevant predictor groups. Large unexplained clusters, systematic residual patterns, or unstable variance estimates can signal a mismatch between the model and data. These checks do not prove the assumptions; they help reveal important failures.

The main alternatives answer different structural questions:

  • Subject-only random intercept: represents within-subject dependence but omits shared-item variation. It may be inadequate when item responses vary systematically.
  • Item-only random intercept: represents shared-item dependence but omits subject-level response tendencies.
  • Fixed effects for a limited set of items: can be appropriate when inference concerns only those specific items. A random item effect instead represents item-to-item variation and supports a population-of-items interpretation, subject to the sampling assumptions.
  • A nested model: is appropriate when one grouping factor truly occurs only within levels of another. It does not represent the same recurring subjects and items that define a crossed experiment.

A random-intercept model has limits. It assumes each subject shifts responses by a common baseline amount across items and each item shifts responses by a common baseline amount across subjects, on the linear-predictor scale. It does not represent every possible subject-by-item pattern, nor does it guarantee that repeated trials have no additional dependence. If the design or scientific question requires other random-effect structures, they must be justified and specified separately. The earlier material on GLM provides the response-distribution and link-function background; the crossed structure adds the two sources of grouping dependence.

Common Pitfall

Common mistake: “Each response belongs to one subject and one item, so the item is nested within the subject.” This confuses the membership of one observation with the relationship among levels of the grouping factors. If the same item is answered by multiple subjects and each subject answers multiple items, neither factor is nested in the other; both effects are crossed. Model the repeated memberships, then check whether the observed schedule is fully or partially crossed.
Key takeaway: In a crossed subject-and-item GLMM, each response receives both a subject and an item contribution. Two responses are dependent through the random effects they share; identify those memberships before choosing or interpreting the model.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. A participant responds to six questions, and each question is answered by many participants. Are participant and question effects crossed or nested? Explain.
  2. In a Gaussian crossed-intercept model, let \(\tau_S^2=0.25\), \(\tau_I^2=0.09\), and \(\sigma^2=0.66\). What is the covariance between two distinct responses from the same subject but different items?
  3. Using the variances in question 2, what is the marginal variance of one response and the correlation between two distinct responses to the same item from different subjects?
  4. Why is the Gaussian sum-of-variance-components covariance formula generally not the response-scale covariance formula for a binary logistic GLMM?

Solutions. (1) They are crossed: participants respond to multiple questions, and questions recur across participants. (2) The responses share only the subject intercept, so their covariance is \(\tau_S^2=0.25\) squared response units. (3) The marginal variance is \(0.25+0.09+0.66=1.00\). Different subjects responding to the same item share only the item effect, so covariance is \(0.09\) and correlation is \(0.09/\sqrt{1.00(1.00)}=0.09\). (4) The logistic link is nonlinear; the random effects act on the logit scale, and the response-scale covariance depends on the joint distribution of the conditional means, not simply on adding latent variance components.

Clinical Biostats