Tutorials › Multi-Omics Data Integration › Stability Of Subgroups With Covariate Adjustment

Stability of Discovered Subgroups · Tutorial 499 of 597

Stability Of Subgroups With Covariate Adjustment

Use paired resampling, feature adjustment, and partition comparisons to assess whether discovered subgroups persist beyond prespecified covariate effects.

Advanced 12 min read

What You'll Learn

  • Define which covariate-adjusted subgroup stability question an analysis targets.
  • Residualize omics features without leaking information across resamples.
  • Compare raw and adjusted partitions on matched samples using established agreement measures.
  • Separate pipeline differences from sampling and algorithmic variability.
  • Diagnose when adjustment, sparse covariate overlap, or small subgroups undermines conclusions.

Why Assess Stability After Covariate Adjustment?

A subgroup solution can be reproducible and still reflect differences in age, treatment, cohort, or another measured covariate rather than a pattern in the omics data that persists beyond those differences. The relevant question is not simply whether a clustering algorithm returns similar labels repeatedly. It is whether its partition remains similar when the analysis accounts for covariates chosen in advance, and whether any observed change is larger than the variability expected from resampling and algorithmic choices.

“Accounting for covariates” can mean different things. Here, the main approach is to compare the same clustering pipeline applied to the original omics features and to features adjusted for prespecified covariates. A second, complementary approach is to examine stability within covariate strata or under covariate-balanced resampling. These approaches answer related but not identical questions. Neither establishes that a subgroup is causal, biologically meaningful, or free of unmeasured confounding.

Definition: Covariate-adjusted subgroup stability is the degree to which a subgroup partition persists under a prespecified analysis that accounts for measured covariates, assessed relative to the ordinary sampling and algorithmic variability of the clustering procedure. The adjustment method, covariates, resampling scheme, and partition-comparison measure must be stated to make the assessment interpretable.

Specify the Comparison Before Clustering

Let \(X_{ij}\) be the value of omics feature \(j\) for participant \(i\), and let \(C_i\) denote the vector of prespecified covariates for that participant. A common feature-adjustment model is

$$ X_{ij} = \beta_{0j} + C_i^\mathsf{T}\beta_j + \varepsilon_{ij}. $$

The adjusted value is the residual after fitting the covariate model. For categorical covariates, \(C_i\) is represented by indicator variables; for continuous covariates, a linear term is appropriate only if that form is defensible. Nonlinear terms or interactions may be needed when specified by the scientific question and supported by the data. Residualization removes the modeled covariate-associated component; it does not prove that all covariate effects have been removed.

A central safeguard is to fit this model using only the observations in a resample or training set. If a participant is held out for evaluation, the fitted coefficients and any transformations or scaling parameters must be estimated without that participant, then applied to that participant. Otherwise, information from the held-out data leaks into the adjusted features and can make apparent reproducibility optimistic.

The target should also be explicit. If the aim is to find subgroups in molecular variation beyond age and batch, adjustment may be appropriate. If a covariate is part of the biological mechanism defining the subgroup, removing its associated signal can erase meaningful structure. Covariates should therefore be selected on scientific grounds before inspecting which choice gives the most stable clustering.

A Paired Resampling Design

Use the same resampled participants for the unadjusted and adjusted pipelines. Keep other choices as comparable as possible: feature filtering, scaling, number of clusters, clustering method, and algorithm settings. Align labels before comparing partitions, since cluster labels themselves are arbitrary. The Adjusted Rand Index (ARI), defined in the earlier material on Adjusted Rand Index For Run-To-Run Agreement, is one useful measure: it compares pairwise co-membership and adjusts agreement for chance. An ARI near 1 indicates strong agreement; an ARI near 0 indicates agreement at about the chance-adjusted reference level. Its interpretation still depends on the data and cluster structure.

For each resample, record at least three kinds of comparisons: unadjusted versus adjusted partitions on the same participants; unadjusted versus unadjusted partitions from different resamples; and adjusted versus adjusted partitions from different resamples. The latter two describe each pipeline’s resampling stability. If algorithmic randomness matters, repeat each pipeline with multiple random starts or seeds within each resample, rather than attributing all variation to sampling.

1
Prespecify the adjustment.
Name the covariates, model forms, feature-processing steps, clustering method, and cluster count before comparing stability.
2
Resample in matched pairs.
Use identical participant resamples for the unadjusted and adjusted pipelines, and account for cohort or batch structure where the design requires it.
3
Fit and cluster within each resample.
Estimate adjustment models and preprocessing parameters using only that resample; cluster both versions using otherwise matched settings.
4
Compare the right partitions.
Align labels and calculate cross-pipeline agreement and within-pipeline resampling agreement on shared participants.
5
Interpret differences against variability.
A lower cross-pipeline agreement is more suggestive of a covariate-related change when it is consistently lower than the ordinary variation within each pipeline.

Why Matched Comparisons Help

Suppose each resample \(r\) gives an unadjusted partition \(U_r\) and an adjusted partition \(A_r\). A cross-pipeline disagreement can be summarized as \(D_r = 1-\operatorname{ARI}(U_r,A_r)\). A within-pipeline disagreement can be summarized by comparing partitions from two resamples in the same pipeline. Matching the pipelines within each resample holds the participant set constant for the direct comparison; it does not remove every source of noise, but it avoids mistaking a change in sampled participants for a change caused by the adjustment pipeline.

This logic is a paired-comparison principle. If both pipelines are run on different resamples, the observed difference mixes pipeline changes with sample changes. By contrast, for a matched resample, the participants are the same in both runs, so a systematic difference in their partitions is more directly attributable to the changed pipeline, subject to algorithmic randomness and implementation choices.

The comparison is not a formal causal effect of covariates. It is a sensitivity analysis: it asks how the discovered partition changes under a specified adjustment. Evidence for a covariate-driven change is stronger when cross-pipeline disagreement is repeatable across resamples, exceeds typical within-pipeline disagreement, and is accompanied by a plausible relationship between the covariate and the original partition.

Worked Example: Calculating Agreement for One Matched Resample

In a hypothetical matched resample of eight participants, suppose the raw-feature and covariate-adjusted solutions each contain two clusters. Their overlap table is:

Adjusted cluster 1Adjusted cluster 2
Raw cluster 131
Raw cluster 213

The row totals and column totals are all 4. For a contingency table with entries \(n_{ij}\), row totals \(a_i\), column totals \(b_j\), and \(n\) participants, the ARI is

$$ \operatorname{ARI} = \frac{\sum_{ij}\binom{n_{ij}}{2} - \frac{\left(\sum_i \binom{a_i}{2}\right)\left(\sum_j \binom{b_j}{2}\right)}{\binom{n}{2}}} {\frac{1}{2}\left(\sum_i \binom{a_i}{2}+\sum_j \binom{b_j}{2}\right) - \frac{\left(\sum_i \binom{a_i}{2}\right)\left(\sum_j \binom{b_j}{2}\right)}{\binom{n}{2}}}. $$

Here, \(\sum_{ij}\binom{n_{ij}}{2} = 3+0+0+3=6\), while each marginal sum is \(\binom{4}{2}+\binom{4}{2}=12\), and \(\binom{8}{2}=28\). Therefore,

$$ \operatorname{ARI} = \frac{6-(12\times12/28)}{(12+12)/2-(12\times12/28)} = \frac{0.8571}{6.8571} = 0.1250. $$

The two partitions have low chance-adjusted agreement in this resample. This alone does not show that adjustment caused a systematic change: the result must be compared with within-pipeline resampling variability and repeated across matched resamples.

Worked Example: Comparing Cross-Pipeline and Resampling Variability

Suppose a hypothetical analysis produces three paired resamples. The unadjusted within-pipeline ARIs between resample runs are 0.84, 0.80, and 0.82; the adjusted within-pipeline ARIs are 0.83, 0.79, and 0.81. The matched cross-pipeline ARIs are 0.58, 0.61, and 0.57.

The mean unadjusted within-pipeline ARI is \((0.84+0.80+0.82)/3 = 0.8200\). The mean adjusted within-pipeline ARI is \((0.83+0.79+0.81)/3 = 0.8100\). The mean cross-pipeline ARI is \((0.58+0.61+0.57)/3 = 0.5867\).

The corresponding mean disagreements, calculated as 1 minus each mean ARI, are 0.1800 for the unadjusted pipeline, 0.1900 for the adjusted pipeline, and 0.4133 across pipelines. In this hypothetical result, cross-pipeline disagreement is substantially larger than ordinary within-pipeline disagreement, while both pipelines are fairly stable within themselves. That pattern is consistent with a repeatable partition change associated with the adjustment choice. It does not, by itself, identify which partition is scientifically preferable or establish that a covariate caused the change.

Complementary Diagnostics and Alternatives

Feature residualization is not the only way to investigate covariate dependence. Stratified or covariate-balanced resampling can test whether partitions persist when resamples preserve or balance covariate distributions. This is useful when adjustment models are difficult to specify, but it changes the resampling target: results describe stability under the chosen sampling constraints, not the effect of residualizing every feature. If some covariate combinations are absent or rare, balancing may discard many participants or create small, unstable resamples.

A covariate-only partition or a table of covariate distributions across the discovered clusters can reveal whether the original labels track a covariate. Such diagnostics are descriptive. Strong alignment between cluster and batch, for example, raises concern about technical structure, but does not demonstrate that batch explains all omics variation. Conversely, weak marginal association does not rule out nonlinear or joint covariate effects.

A common confusion is to treat an ARI as “adjusted for covariates.” The chance correction in the ARI refers to expected agreement between partitions under its reference model; it does not control for age, batch, treatment, or any other measured variable. Covariate adjustment must occur in the analysis design or in a clearly defined conditional comparison.

Worked Example: Checking a Batch-Related Change

In a hypothetical dataset, a raw two-cluster solution assigns 18 of 20 samples from batch A to cluster 1, while cluster 1 contains 8 of 20 samples from batch B. After feature-wise adjustment for batch, the assignments are more evenly distributed across batches. Suppose matched-resample mean ARI between raw and adjusted partitions is 0.55, while within-pipeline mean ARIs are 0.86 and 0.84.

The cross-pipeline disagreement is \(1-0.55=0.45\); the within-pipeline disagreements are \(1-0.86=0.14\) and \(1-0.84=0.16\). The cross-pipeline disagreement exceeds both within-pipeline values, and the raw labels are strongly imbalanced by batch. Together, these hypothetical diagnostics support the interpretation that batch adjustment changes a reproducible partition that was associated with batch. They do not prove that the adjusted groups are biologically valid: the result still depends on the batch model, feature processing, and the available overlap of batches and biological states.

Assumptions, Failure Modes, and Limitations

Interpretation depends on several conditions. The covariates should be measured consistently, selected before examining stability results, and modeled adequately. There must be enough overlap in covariate values to distinguish covariate-associated variation from other structure. The clustering method and preprocessing must be applied consistently across resamples, and comparisons must use participants assigned in both partitions. If clusters are very small, their apparent agreement can be dominated by a few participants; report cluster-wise summaries as well as a global agreement measure.

Residualization can fail when the covariate relationship is nonlinear, when important interactions are omitted, or when a covariate is nearly confounded with the biological signal of interest. In the latter case, the data may not contain enough information to separate those sources. Adjustment may also remove signal that is scientifically relevant, particularly if a covariate is downstream of disease or part of the subgroup definition. These are reasons to state the estimand and scientific rationale, not reasons to select whichever adjusted solution looks most attractive.

Diagnostics should include distributions of covariates by cluster, residual patterns against continuous covariates, the number and size of clusters in each run, and stability across resamples and random starts. Watch for empty or tiny clusters, convergence failures, and changing feature sets. If the adjusted model is fit separately in every resample, large coefficient variation is itself informative: it may indicate weak covariate support or an over-flexible model. A failed or materially different resample should be documented rather than silently excluded.

The key limitation is that stability is not validity. A stable partition may reflect an unmeasured technical factor, an inappropriate adjustment model, or a structure with no useful biological interpretation. Establishing usefulness requires evidence beyond this stability assessment.

Common mistake: “The adjusted ARI is high, so the clusters are independent of the covariates.” This is incorrect: the ARI measures agreement between partitions, not covariate independence. Instead, compare matched raw and adjusted partitions with within-pipeline variability, inspect covariate distributions, and state precisely what the adjustment model does and does not remove.

Check Your Understanding

Answer each question before reviewing the brief solutions.

  1. Why should raw and adjusted pipelines use the same participant resamples when comparing their partitions?
  2. A matched cross-pipeline mean ARI is 0.72, while within-pipeline mean ARIs are 0.70 and 0.73. What is a cautious interpretation?
  3. Does an ARI of 0.90 show that clusters are independent of batch? Explain.
  4. Why should covariate adjustment be fitted inside each resample rather than once using all participants?

Solutions. (1) Matching holds the sampled participants constant for each direct comparison, reducing the chance that sample composition is mistaken for a pipeline effect. (2) Cross-pipeline agreement is similar to within-pipeline agreement, so the observed adjustment-related difference is not clearly larger than ordinary resampling variability; more diagnostics and repetitions may be needed. (3) No. ARI measures agreement between partitions, not independence from batch; inspect batch distributions and compare prespecified adjusted and unadjusted analyses. (4) Fitting on all participants lets information from held-out or out-of-resample observations influence the adjustment, causing information leakage and potentially optimistic stability estimates.

Clinical Biostats