Tutorials › Statistical Methods for Single-Cell RNA Sequencing › Choosing CCA or PCA Representations for Anchors

Integration Methods and Their Benchmarking · Tutorial 169 of 700

Choosing CCA or PCA Representations for Anchors

Understand how CCA and PCA prioritize variation differently, and use shared-state assumptions and diagnostics to choose an anchor representation.

Advanced 10 min read

What You'll Learn

  • Distinguish CCA’s cross-dataset correlation objective from PCA’s within-dataset variance objective.
  • Identify conditions under which shared covariance can reveal a biological state that PCA underweights.
  • Recognize how confounding, weak overlap, and unstable covariance estimates can distort CCA matches.
  • Compare common PCA strategies with CCA for anchor discovery.
  • Use numerical summaries and sensitivity checks to evaluate a representation choice.

Why the Representation Matters

An anchor is a candidate pair of cells from different datasets that appear to represent a shared biological state. As established in the earlier material on identifying anchors in shared latent spaces, the representation determines which features contribute to distances and therefore which cells can become candidate matches. Choosing canonical correlation analysis (CCA) or principal component analysis (PCA) is not merely a computational choice: each method gives priority to a different pattern in the data.

PCA seeks directions that explain large amounts of variation within a dataset or a combined data matrix. CCA seeks directions whose variation is correlated across two datasets. If a shared cell-state signal is modest within each dataset but coordinated across them, CCA can make that signal more visible. If the strongest cross-dataset correlation is instead caused by a shared nuisance effect, or by an unrepresentative subset of cells, CCA can focus anchor discovery on the wrong structure.

Definition: Let \(X\) and \(Y\) denote feature representations of two datasets, with features referring to a common set of genes or other selected measurements. A PCA representation uses directions chosen to maximize within-dataset variance. A CCA representation uses paired directions chosen to maximize correlation between projections from the two datasets. In anchor discovery, candidate cell pairs are then compared in the resulting representation; the representation itself does not establish that a pair is biologically equivalent.

What the Two Objectives Prioritize

For a centered feature vector \(X\) with covariance matrix \(\Sigma_{XX}\), a first principal direction \(w\) solves

$$ \max_{w:\,w^\mathsf{T}w=1} w^\mathsf{T}\Sigma_{XX}w. $$

Thus, the first principal component is the direction with greatest variance under the chosen scaling and feature set. Subsequent components capture the greatest remaining variance subject to orthogonality to earlier components. When PCA is run separately for each dataset, the component axes need not correspond across datasets; when run on a combined matrix, large dataset-specific effects can dominate the shared axes.

For paired random vectors \(X\) and \(Y\), CCA chooses directions \(a\) and \(b\) to maximize the correlation of their projections:

$$ \max_{a,b} \frac{a^\mathsf{T}\Sigma_{XY}b} {\sqrt{(a^\mathsf{T}\Sigma_{XX}a)(b^\mathsf{T}\Sigma_{YY}b)}}. $$

Here \(\Sigma_{XY}\) is the cross-covariance matrix. The first canonical correlation, \(\rho_1\), is the largest achievable correlation; later canonical directions are constrained to capture additional cross-dataset correlation. In classical CCA, the observations in \(X\) and \(Y\) are paired. Single-cell integration datasets usually do not contain the same cells measured twice, so a practical CCA-based integration method must operationalize the shared-variation objective without treating arbitrary cells as known pairs. The formula describes the objective, not a license to calculate cross-covariance from unrelated cell rows.

This distinction matters when interpreting an embedding. CCA is not simply “PCA that removes batch,” and a high canonical correlation does not prove that the corresponding signal is biological. PCA does not explicitly seek cross-dataset agreement, but it may produce a more stable representation when the datasets already share dominant structure and estimated cross-dataset covariance is unreliable.

When Shared Covariance Helps

CCA is most useful when the datasets have genuine shared cell states, those states induce coordinated changes across features, and each dataset also contains substantial variation that is not shared. The shared-state assumption from earlier integration material is essential: there must be enough biological overlap for cross-dataset structure to be informative. CCA can then elevate shared structure relative to dataset-specific variation, even if that structure is not the leading source of within-dataset variance.

This benefit depends on feature selection and preprocessing. A large number of noisy or weakly informative features can make covariance estimates unstable, while a set dominated by condition-associated genes can make a condition effect look like the shared signal. Scaling also changes what the methods emphasize. PCA on unscaled measurements can be driven by high-variance genes; scaling every gene to unit variance can amplify low-count noise. CCA likewise depends on the features and regularization used to estimate its directions.

Worked Example: A Shared State Is Modest but Coordinated

Suppose a hypothetical integration analysis has two candidate directions. Direction S tracks a shared cell-state program, while direction B tracks a large within-dataset batch effect. For illustration, assume the PCA variance summaries are 15% for S and 70% for B. Assume the CCA procedure estimates cross-dataset correlations of 0.90 for S and 0.12 for B.

PCA choice. Comparing within-dataset variance, \(70\%>15\%\), so PCA prioritizes B. A PCA-based distance can therefore be strongly influenced by the batch direction, even though it explains much less shared structure across datasets.

CCA choice. Comparing cross-dataset correlations, \(0.90>0.12\), so CCA prioritizes S. The shared-state direction is more aligned across datasets, despite explaining less variance within either dataset.

This supports using CCA when independent evidence makes S biologically plausible and the shared states are represented in both datasets. It does not show that all CCA anchors are correct: a correlated technical effect could produce the same numerical pattern. The percentages and correlations here are hypothetical summaries, not measurements from a real study.

Why CCA Can Distort Matches

The same objective that helps CCA find common structure can make it vulnerable to shared nuisance variation. For example, if both datasets were processed with a similar stress-inducing protocol, a stress response might be highly correlated across them. CCA can emphasize that response because it is shared, even if it does not identify the cell states the integration is intended to align. Shared covariance is evidence of coordinated variation, not by itself evidence of biological equivalence.

CCA can also be unstable when the number of features is large relative to the number of informative cells, when features are highly collinear, or when overlap between datasets is weak. In these settings, directions may fit accidental correlations in the observed data. Regularization and careful feature selection can reduce instability, but they cannot create shared biological information that is absent.

Worked Example: A High Correlation Can Track a Confounder

Consider hypothetical candidate directions G and T. G represents a desired shared cell-state program; T represents a shared processing response. Suppose CCA estimates correlations of 0.62 for G and 0.94 for T. Suppose external design knowledge indicates that T is driven by a protocol applied to both datasets, while the cell-state program is expected to be less strongly expressed in one dataset.

The CCA objective ranks T first because \(0.94>0.62\). If an analyst interprets the first canonical direction as “the shared biology,” that conclusion does not follow from the calculation. The objective establishes that the projected variation is more correlated for T; it does not identify the cause of that correlation.

A defensible interpretation therefore checks the genes contributing to the direction and compares them with the experimental design and expected cell-state markers. If T is plausibly a technical or condition-related effect, anchor discovery based on that direction risks matching cells by shared processing response rather than by the intended biological state. This example illustrates a limitation of CCA, not evidence that the hypothetical correlations are real.

When PCA Is the More Reliable Choice

PCA is often attractive when datasets have broadly similar structure, the main sources of variation are expected to be relevant to the integration target, and a cross-dataset covariance estimate would be noisy or difficult to interpret. PCA can also be useful as a sensitivity representation: if candidate matches depend entirely on one estimated CCA direction, that dependence deserves scrutiny.

“PCA representation” covers different procedures. Separate PCA fits can adapt to each dataset’s variance structure, but their axes are not automatically comparable. A common or pooled feature space offers shared coordinates, but pooled PCA may devote leading components to large batch or condition differences. Reciprocal PCA approaches use dataset-specific PCA models and cross-projection to seek correspondences; these can be useful when datasets are similar but not identical. None of these choices guarantees that the resulting distances represent the intended biology.

Worked Example: Weak Estimated Covariance Favors a PCA Sensitivity Check

Suppose two hypothetical datasets have a stable shared cell-state axis that explains 48% of the retained within-dataset variance. A CCA fit on a small, noisy feature set estimates a correlation of 0.28 for that axis and 0.31 for a direction dominated by a few low-count genes. Across repeated feature subsamples, the latter direction’s estimated correlation ranges from 0.10 to 0.76.

The apparent CCA advantage is only \(0.31-0.28=0.03\) in the original fit, and the competing direction is highly variable across subsamples. This is weak evidence that the CCA direction is a stable shared signal. The PCA axis, by contrast, explains 48% of within-dataset variance and is assumed in this example to recur across the two datasets.

Under these hypothetical conditions, PCA is a reasonable primary representation, with CCA used as a sensitivity comparison rather than accepted as the more informative embedding. The calculation does not prove PCA is biologically correct: it says that the small CCA ranking difference is outweighed by instability, so it should not control the conclusion without additional support.

A Short Justification for the Difference

The objectives themselves explain why the rankings can disagree. PCA evaluates a direction using \(\Sigma_{XX}\), the covariance within one dataset. CCA evaluates pairs of directions using both within-dataset covariance matrices and the cross-covariance \(\Sigma_{XY}\). In the nonsingular case, whiten each dataset so its transformed covariance is the identity. The cross-covariance of the whitened variables is

$$ K=\Sigma_{XX}^{-1/2}\Sigma_{XY}\Sigma_{YY}^{-1/2}. $$

The singular values of \(K\) are the canonical correlations: they measure the strongest correlations achievable after accounting for each dataset’s own scale and covariance. PCA instead orders eigenvalues of a within-dataset covariance matrix. Since the two procedures optimize different matrices, no general rule requires their leading directions—or their resulting candidate anchors—to agree.

This argument also reveals an assumption behind ordinary CCA: the covariance matrices must be estimable and invertible, or a suitable regularized method must be used. When there are more features than informative observations, an unregularized inverse may not exist. A method that proceeds without addressing this issue can return unstable or undefined directions.

Choosing and Checking a Representation

The choice should be tied to the integration target: preserve shared biological states while avoiding the alignment of differences that the analysis intends to retain. Before preferring one representation, check whether its assumptions are plausible and whether its leading directions can be interpreted in the study context. Useful diagnostics include:

  • Direction stability: refit after reasonable changes to the feature set or cell subset. Large changes in leading CCA directions suggest that estimated cross-dataset covariance is fragile.
  • Biological interpretability: inspect genes contributing strongly to the directions. A direction dominated by known technical, stress, or condition-associated features may not represent the target state.
  • Overlap: confirm that the datasets plausibly contain the shared states the method is asked to align. Neither CCA nor PCA can establish a reliable match for a state absent from one dataset.
  • Representation sensitivity: compare candidate matches under CCA and a defensible PCA-based representation. Agreement is reassuring but not proof; disagreement identifies matches whose interpretation depends on the representation.
  • Scale and dimension: assess whether normalization, feature scaling, and the number of retained dimensions make the distance calculation meaningful. Too few dimensions can omit relevant state variation; too many can admit noise.

A common mistake is to select CCA automatically because it is designed to find shared variation. The flawed reasoning is: “the datasets are different, so the method that maximizes cross-dataset correlation must remove the unwanted difference.” The correction is that CCA maximizes correlation, including correlation due to nuisance or confounding structure. The analyst must justify that the shared variation being emphasized is relevant to the integration target.

A second mistake is to treat PCA’s largest-variance directions as the most biologically important. A large technical shift can dominate variance, while a meaningful shared state can be relatively subtle. PCA is not inherently more biological or more conservative; its suitability depends on the design, preprocessing, feature set, and target.

Key takeaway: Choose CCA when credible shared states are expected to induce stable, informative cross-dataset covariance. Prefer PCA or a PCA-based sensitivity analysis when that covariance is weak, unstable, or plausibly driven by nuisance structure. In either case, the embedding is a model of similarity, not proof that an anchor pair represents the same biological state.

Check Your Understanding

Answer each question, then compare with the solutions.

  1. Which quantity does PCA maximize, and which quantity does CCA maximize?
  2. A CCA direction has correlation 0.88 across datasets but is dominated by a shared processing response. Why is that not sufficient evidence for biological anchors?
  3. Why can CCA be unstable when the feature count is large relative to the informative sample size?
  4. Two representations produce different candidate matches. What does this disagreement establish, and what does it not establish?

Solutions. (1) PCA maximizes within-dataset variance along a direction; CCA maximizes correlation between projections from the two datasets. (2) CCA identifies coordinated variation, not its cause. A shared processing response can be highly correlated without identifying the target biological state. (3) Covariance estimates become difficult to estimate reliably, and unregularized CCA may require inverses of singular or poorly conditioned covariance matrices. (4) The disagreement establishes that the candidates depend on the representation choice. It does not establish which set is biologically correct; that requires checking assumptions, feature contributions, and study context.

Clinical Biostats