Tutorials › Multi-Omics Data Integration › Decomposing Variance by Cohort and Platform

Batch Effects and Confounding Across Cohorts · Tutorial 101 of 597

Decomposing Variance by Cohort and Platform

Use variance-component models to quantify cohort, platform, interaction, and residual variation, and recognize when the design cannot distinguish their contributions.

Advanced 12 min read

What You'll Learn

  • Specify a crossed random-effects model for one omics feature.
  • Interpret each variance component and its units.
  • Derive method-of-moments estimates from a balanced design.
  • Calculate component proportions from a hypothetical ANOVA table.
  • Explain why confounding prevents attribution of variation to cohort versus platform.
  • Recognize negative method-of-moments estimates and understand their limits.

Why Decompose Feature-Level Variance?

An omics feature can vary across samples for several reasons. Measurements may differ systematically among cohorts, among measurement platforms, and among particular cohort-platform combinations; they also vary among replicate samples or through measurement noise. A variance-component model summarizes these sources on a common scale. It can show, for example, whether variation across the observed samples is mostly associated with cohort-level differences or with residual variation.

This summary is descriptive under the model, not a causal attribution. A large cohort component does not establish that cohort membership caused the feature values to differ. Cohort may also represent differences in recruitment, processing, clinical composition, or other factors. The earlier material on fixed-effect and random-effect batch adjustment distinguishes modeling group-specific shifts from treating group levels as a sample from a wider population. Here the focus is the variance partition and the design conditions needed to interpret it.

A Crossed Variance-Component Model

Definition: For one feature, let \(Y_{cpr}\) be its measured abundance for replicate \(r\) in cohort \(c\) measured on platform \(p\). A crossed random-effects model is \(Y_{cpr}=\mu+A_c+B_p+(AB)_{cp}+\epsilon_{cpr}\), where \(\mu\) is the overall mean, \(A_c\) is the cohort deviation, \(B_p\) is the platform deviation, \((AB)_{cp}\) is the cohort-platform interaction deviation, and \(\epsilon_{cpr}\) is residual variation. The random effects have mean zero and variances \(\sigma_C^2,\sigma_P^2,\sigma_{CP}^2,\sigma_e^2\), respectively.

The standard model assumes that these four sets of random effects are mutually independent, and that effects at distinct levels within a set are independent. Residuals are independent with common variance \(\sigma_e^2\), conditional on the random effects. Normal random effects and residuals are commonly assumed for likelihood-based estimation and standard small-sample inference; the variance-component interpretation itself requires finite variances and the stated independence structure. The feature scale and any transformation must be specified because variances depend on scale.

The model is crossed when cohort and platform levels are combined in the design, rather than one factor being wholly nested within the other. In a balanced design, every cohort-platform cell has the same number \(m\) of replicate observations. Replication within cells is especially important: it helps distinguish the interaction, which is shared by observations in a cell, from residual variation among observations in that cell.

For observations in the same cohort-platform cell, the shared deviation is \(A_c+B_p+(AB)_{cp}\). Under the independence assumptions, its variance is therefore \( \sigma_C^2+\sigma_P^2+\sigma_{CP}^2 \). For a single observation, adding independent residual variation gives marginal variance \( \sigma_C^2+\sigma_P^2+\sigma_{CP}^2+\sigma_e^2 \). These sums are not generally a valid decomposition if effects are correlated or the model omits important structure.

Balanced-Design Estimates and Their Justification

Suppose there are \(C\) cohorts, \(P\) platforms, and \(m\) replicates per cell. A balanced analysis of variance partitions the total sum of squares into cohort, platform, cohort-platform interaction, and residual sums of squares. Their degrees of freedom are \(C-1\), \(P-1\), \((C-1)(P-1)\), and \(CP(m-1)\), respectively. Each mean square, \(MS\), is its sum of squares divided by its degrees of freedom.

The method-of-moments estimates follow by equating observed mean squares to their expectations under this model. In the balanced design, those expectations are:

$$ \begin{aligned} E(MS_E)&=\sigma_e^2,\\ E(MS_{CP})&=\sigma_e^2+m\sigma_{CP}^2,\\ E(MS_C)&=\sigma_e^2+m\sigma_{CP}^2+Pm\sigma_C^2,\\ E(MS_P)&=\sigma_e^2+m\sigma_{CP}^2+Cm\sigma_P^2. \end{aligned} $$

For example, each cell mean averages \(m\) independent residuals, whose variance is \(\sigma_e^2/m\); the cell interaction remains common to all \(m\) observations. Thus cell-to-cell variation beyond residual variation contains the interaction variance. Cohort means also average over \(P\) platforms and \(m\) replicates per platform, while the cohort effect is shared across those observations. These repeated appearances yield the factor \(Pm\) in the cohort mean-square expectation. The platform expression follows analogously.

Solving these expectation equations gives the balanced-design estimates:

$$ \hat{\sigma}_e^2=MS_E,\qquad \hat{\sigma}_{CP}^2=\frac{MS_{CP}-MS_E}{m},\qquad \hat{\sigma}_C^2=\frac{MS_C-MS_{CP}}{Pm},\qquad \hat{\sigma}_P^2=\frac{MS_P-MS_{CP}}{Cm}. $$

These are method-of-moments estimates, not guarantees that every estimated component is nonnegative. They are most straightforward when the design is balanced and the factors are identifiable. For unbalanced or incomplete designs, the same simple mean-square formulas generally do not apply; likelihood-based methods such as restricted maximum likelihood (REML) can estimate components if the design contains enough information to identify them.

Worked Example: Partitioning Variation in a Balanced Design

Hypothetical data. Suppose a transformed feature is measured in \(C=3\) cohorts and \(P=2\) platforms, with \(m=2\) replicates in each of the six cells. The abundance is in log-scale units. Assume the crossed model and its independence conditions are reasonable for this feature. A hypothetical ANOVA summary has \(MS_C=18\), \(MS_P=16\), \(MS_{CP}=10\), and \(MS_E=4\), each in squared log-scale units. The corresponding degrees of freedom are 2, 1, 2, and 6.

Check the mean squares. These values correspond to sums of squares \(SS_C=2(18)=36\), \(SS_P=1(16)=16\), \(SS_{CP}=2(10)=20\), and \(SS_E=6(4)=24\). The total sum of squares is \(36+16+20+24=96\), with \(2+1+2+6=11\) total degrees of freedom.

Estimate the components. Substitution into the balanced-design formulas gives \( \hat{\sigma}_e^2=4 \), \( \hat{\sigma}_{CP}^2=(10-4)/2=3 \), \( \hat{\sigma}_C^2=(18-10)/(2\cdot2)=2 \), and \( \hat{\sigma}_P^2=(16-10)/(3\cdot2)=1 \), all in squared log-scale units.

The estimated total marginal variance is \(2+1+3+4=10\) squared log-scale units. The estimated fractions are \(2/10=20\%\) for cohort, \(1/10=10\%\) for platform, \(3/10=30\%\) for interaction, and \(4/10=40\%\) for residual variation. These percentages describe the model-based partition for this feature and design; they are not percentages of variation causally produced by each factor.

Confounding Limits Attribution

Variance components can only be separated when the observed design supplies distinct information about the factors. If platform is perfectly tied to cohort—for example, every sample in cohort 1 is measured only on platform 1 and every sample in cohort 2 only on platform 2—observed differences between those groups cannot reveal whether they arise from cohort, platform, or their interaction. In a one-to-one pairing of cohort and platform levels, the observed cell deviation contains all three terms \(A_c+B_p+(AB)_{cp}\). Under the model's independence assumptions, the variance of that shared deviation is \(\sigma_C^2+\sigma_P^2+\sigma_{CP}^2\), not merely \(\sigma_C^2+\sigma_P^2\).

If there is only one observation in each observed cell, interaction and residual variation may also be inseparable. Repeated observations in a cell can provide information about residual variation, but they do not by themselves separate cohort from platform when those factors remain perfectly aliased. The earlier material on identifiability and design connectivity gives the corresponding design-matrix perspective. A variance-component model does not repair a design that lacks information.

Worked Example: What a Confounded Design Can Identify

Hypothetical data. Consider two cohorts and two platforms, but suppose cohort 1 is measured only on platform 1 and cohort 2 only on platform 2. There are three replicate samples in each observed cohort-platform cell. Assume the crossed random-effects model above, including its interaction term, and independent random effects with variances \(\sigma_C^2=4\), \(\sigma_P^2=1\), and \(\sigma_{CP}^2=2\), all in squared abundance units.

The shared cohort-platform deviation for any one cell has variance \(4+1+2=7\) squared abundance units. The cell mean over three replicates also includes averaged residual variation: if \(\sigma_e^2=3\), its residual contribution has variance \(3/3=1\), so the variance of a cell mean under the model is \(7+1=8\).

Although these hypothetical component values yield a combined shared-deviation variance of 7, the observed design does not provide separate evidence for the cohort, platform, and interaction contributions. The fact that three replicates reduce residual variance in each cell does not change the complete cohort-platform aliasing. A fitted analysis may impose a model or constraints and return numerical estimates, but those estimates cannot be interpreted as uniquely learned separate contributions from this design alone.

Negative Estimates, Diagnostics, and Alternatives

Worked Example: A Negative Moment Estimate

Hypothetical data. In a balanced design with \(C=3\), \(P=2\), and \(m=2\), suppose the mean squares are \(MS_E=4\), \(MS_{CP}=2\), \(MS_C=10\), and \(MS_P=8\), in squared abundance units. Assume the intended model is appropriate and the design is fully crossed.

The unconstrained method-of-moments calculations give \( \hat{\sigma}_e^2=4 \), \( \hat{\sigma}_{CP}^2=(2-4)/2=-1 \), \( \hat{\sigma}_C^2=(10-2)/(2\cdot2)=2 \), and \( \hat{\sigma}_P^2=(8-2)/(3\cdot2)=1 \).

A negative variance is not a plausible population variance. It signals sampling variability in the mean squares, or possible inadequacy of the assumptions or model; it does not mean the true interaction variance is negative. The method-of-moments estimate is unconstrained, so it need not be a valid final variance estimate. A constrained likelihood fit, often using REML, can keep estimated variances nonnegative, although a boundary estimate of zero still reflects limited information rather than proof that interaction is absent.

Useful checks include confirming that all relevant cohort-platform combinations are represented, checking replication and missingness patterns, and verifying that the component formulas match the actual design. Investigate whether residual spread differs markedly across groups or whether a few observations dominate sums of squares. Such patterns challenge the common residual variance or independence assumptions. A large component is also sensitive to the scale of measurement: variance on a log-transformed abundance scale is not directly comparable to variance on the original scale.

The main alternative is to treat cohort or platform levels as fixed effects when the goal is to estimate differences among these particular levels. Fixed-effect contrasts answer questions about specified level differences; variance components summarize variability among levels under a random-effects interpretation. Either approach can be inappropriate if the design is confounded. In unbalanced designs, REML is often preferred to simple moment formulas, but it still depends on an identifiable design and a defensible model. Neither method determines whether an observed component is technical or biological without appropriate design information.

Why the Decomposition Matters

A feature-level variance partition can help prioritize investigation: a substantial platform component may motivate checks of measurement comparability, while substantial cohort variation may indicate heterogeneity that matters for pooled analyses. The partition is most useful when reported with the feature scale, design, component estimates, and uncertainty where available. Comparing proportions across features also requires care: features with different total variances can have similar proportions but very different absolute variability.

The central limitation is attribution. The estimated components describe variation under a specified model and sampling structure. When cohort and platform are confounded, the data may support only a combined contrast or variance, not a unique division between sources. Avoid reading a software output as evidence that every printed component was independently identified.

Key takeaway: In a crossed model, the feature’s marginal variance is the sum of cohort, platform, interaction, and residual variances under the stated independence assumptions. Balanced designs yield simple mean-square estimates, but interpretation depends on replication, model adequacy, and the ability to distinguish the factors in the design.

Check Your Understanding

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

  1. In the crossed model, what is the variance of the shared cohort-platform deviation for observations in the same cell?
  2. For a balanced design with \(m=3\), \(MS_{CP}=11\), and \(MS_E=5\), calculate the moment estimate of \(\sigma_{CP}^2\).
  3. Why can replicates within each cell fail to distinguish cohort from platform when each cohort occurs on only one platform?
  4. What does a negative method-of-moments estimate of a variance component mean?

Solutions. (1) Independence gives \(\sigma_C^2+\sigma_P^2+\sigma_{CP}^2\), because all three effects are shared within the cell. (2) \( \hat{\sigma}_{CP}^2=(MS_{CP}-MS_E)/m=(11-5)/3=2 \) squared measurement units. (3) Replicates provide information about within-cell residual variation, but the cohort and platform labels still change together, so their separate contributions remain aliased. (4) It is an unconstrained estimate affected by sampling variability or model/design limitations; it is not a negative population variance and should not be interpreted as one.

Clinical Biostats