Choosing PCs Is a Purpose-Dependent Decision
Principal component analysis orders directions by the amount of variation they capture. That ordering is useful, but it does not supply a universal stopping point. Choosing components for visualization means deciding how much of the data's structure to retain for a particular display, while avoiding dimensions dominated by unstable or irrelevant variation. A scree plot can suggest where additional components contribute less variance; stability checks and gene-loading patterns help assess what those components represent.
The choice also depends on what “for visualization” means. A plot with two principal-component axes displays only two dimensions. In contrast, a visualization method that constructs a two-dimensional map from a higher-dimensional representation may use a selected set of PCs as its input. In either case, the number of PCs retained is a modeling choice, not a biological fact. It should be supported by evidence and reported clearly.
The eigenvector for a component gives its gene loadings, and projecting cells onto that vector gives their PC scores. A component's sign is arbitrary: multiplying all its loadings and scores by \(-1\) describes the same axis. Consequently, “positive-loading genes” have no intrinsic status apart from their contrast with negative-loading genes.
What a Scree Plot Can and Cannot Tell You
A scree plot places component number on the horizontal axis and component variance, often the eigenvalue or explained-variance proportion, on the vertical axis. A sharp decline followed by a flatter tail can indicate that early components capture substantially more variation than later ones. The apparent bend, or elbow, is a useful summary, but it is not a test that identifies a uniquely correct number of PCs. Some data have a gradual decline with no clear elbow.
Cumulative explained variance answers a different question: how much total variance is represented by the first \(k\) PCs? A target such as 80% or 90% can be a convenient description, but it is not a general rule for single-cell visualization. Many small, meaningful biological effects may be spread across later components; conversely, a component can explain substantial variance because of technical or otherwise unhelpful structure. Explained variance measures variation, not biological importance.
This ratio has a direct justification. The total variance across all component scores is the sum of the eigenvalues, because the trace of the covariance matrix equals the sum of its eigenvalues. Orthogonal PC axes partition that variance: the first \(k\) axes account for \(\lambda_1+\cdots+\lambda_k\). Dividing this retained variance by the total gives \(R_k\). This calculation quantifies variance retained; it does not establish that the retained variation is the variation most useful to display.
Worked Example: Reading an Elbow Without Treating It as a Rule
Suppose a hypothetical analysis has total variance 100 units, with the first eight eigenvalues \(30, 20, 12, 8, 6, 5, 4,\) and \(3\). The remaining components together account for 12 units. The scree plot drops steeply through PC4 and then flattens. Calculate the cumulative variance through PC4 and PC6, and make a provisional visualization choice.
Through PC4, the retained variance is \(30+20+12+8=70\) units, so \(R_4=70/100=0.70\), or 70%. Through PC6, it is \(70+6+5=81\) units, so \(R_6=81/100=0.81\), or 81%.
The marked decline in successive eigenvalues through PC4, followed by smaller contributions, makes four PCs a defensible starting choice if the goal is to retain the dominant structure compactly. Six PCs retain more variance, but the increase from four to six is 11 percentage points. Whether that added variation is useful should be checked against component stability and gene-loading patterns. Neither the 70% nor the 81% figure proves that one choice is correct.
The total of 100 units is stipulated here for illustration. In practice, if only a truncated SVD output is available, the sum of its reported eigenvalues is not necessarily the full total variance. Do not treat that truncated sum as the denominator for full-data explained-variance proportions unless it is known to include all components.
Check Whether Components Are Stable
A component that changes substantially under small, reasonable perturbations may be a weak basis for a robust display. Stability can be assessed by repeating the analysis after resampling cells or making modest changes to preprocessing choices, while keeping the comparison meaningful. For example, when the question is sampling stability, keep the gene set and scaling rule fixed and compare fits on overlapping cells. When preprocessing sensitivity is the question, vary one defensible choice at a time.
To compare a component across fits, first match components by their order or by similarity, then compare their loading vectors on the same genes. Since signs can flip, a simple sign-invariant similarity for unit-length loading vectors \(v_a\) and \(v_b\) is \(|v_a^\mathsf{T}v_b|\). Values close to 1 indicate similar directions; values nearer 0 indicate dissimilar directions. This comparison is most interpretable when the component is separated from neighboring eigenvalues.
When adjacent eigenvalues are close, individual PCs can rotate within a nearly equivalent subspace. Two fits may then have different-looking PC loadings but similar combined subspaces. In that situation, compare the subspaces—for example, using principal angles—rather than declaring each component unstable solely from one-to-one loading correlations. Stability is always relative to the perturbations considered; it does not mean a component is biologically valid.
Worked Example: Using Resampling Stability to Set a Provisional Cutoff
In a hypothetical dataset, investigators repeat PCA on three overlapping-cell subsamples, holding the gene set and scaling fixed. After matching components and allowing sign flips, the absolute loading-vector correlations between the reference fit and the two resampled fits are: PC1, 0.98 and 0.97; PC2, 0.96 and 0.95; PC3, 0.94 and 0.93; PC4, 0.68 and 0.72. Assume PCs 4 and 5 have similar eigenvalues.
For PC2 in the first comparison, the sign-invariant similarity is \(0.96\); a raw correlation of \(-0.96\) would give the same result because the sign of a PC is arbitrary. PCs 1–3 show high similarity across these particular subsamples. PC4 is less consistent, but its closeness in eigenvalue to PC5 means that rotation between the two axes is plausible. The low one-to-one correlation alone does not establish that the combined PC4–PC5 subspace is unstable.
A cautious provisional choice is to use the first three PCs if a compact, individually stable representation is needed, then check whether the PC4–PC5 subspace is stable and whether its gene patterns add relevant structure before including more components. These correlations are diagnostics, not a universal pass threshold. The resampling scheme and the purpose of the display determine how much instability is concerning.
Use Gene Loadings to Interpret, Not Automatically Exclude
For each candidate PC, inspect genes with the largest absolute loadings and the contrast between the two loading directions. Ask whether the pattern is coherent and relevant to the intended visualization. A component whose prominent genes are associated with a known cell program may capture meaningful variation. A component dominated by a technical feature or quality-control pattern may be less useful for the display's purpose. But a gene list alone rarely settles the question: correlated genes can share a signal, and a familiar technical association does not prove that all variation along the component is unwanted.
Loading concentration can be summarized with squared loadings. For a unit-length loading vector, the squared loadings sum to 1, so the sum over a selected gene set gives the fraction of the loading vector's squared magnitude assigned to that set. This is a descriptive diagnostic, not a fraction of biological variance explained by those genes.
Worked Example: Interpreting a Component with a Concentrated Loading Pattern
Suppose PC5 in a hypothetical analysis has unit-length loadings. Five genes associated with mitochondrial transcripts have loadings \(0.40, -0.36, 0.34, -0.32,\) and \(0.30\). Their squared-loadings sum is
Thus, these five genes account for about 59.8% of the squared magnitude of the PC5 loading vector. Their mixed signs mean the component contrasts genes on one side of the axis with genes on the other; the sign itself is arbitrary. The concentration motivates checking the PC5 cell scores against relevant quality-control measures and examining whether the pattern is plausible for the cells being visualized.
If the score pattern is strongly associated with a technical quality measure and the goal is to display biological state structure, the evidence may argue against including PC5 in that visualization. It does not prove that the component is purely technical or that the genes should be removed. The interpretation depends on the broader analysis and should be reported as a reasoned choice, not as a consequence of the squared-loading calculation alone.
A Practical Decision and Its Boundaries
A defensible choice combines evidence rather than applying a single cutoff. Start with the scree shape and cumulative variance to identify a compact candidate range. Check whether candidate components are reproducible under relevant perturbations, taking near-tied eigenvalues into account. Then examine loading patterns and, where appropriate, relationships between component scores and known biological or technical variables. Choose a number that serves the stated display purpose, and record the rationale and sensitivity of the result to nearby choices.
Decide whether PCs will be plotted directly on two axes or supplied as a higher-dimensional input to another visualization method. State which representation is being selected.
Use the scree pattern and cumulative variance together. Treat an elbow or variance target as a clue, not a definitive threshold.
Compare loadings or subspaces across suitable perturbations, and inspect whether prominent genes and scores align with the intended interpretation.
State how many PCs were used, what evidence informed the choice, and whether nearby choices materially changed the display.
This selection is not automatically the selection for clustering. A visualization may favor a compact representation that makes broad structure legible, while clustering can depend on distinctions that are less prominent in a two-dimensional display. Decisions for clustering require their own evaluation of the representation and the clustering objective; a scree elbow alone does not determine them. Likewise, visible separation in a plot does not by itself establish discrete cell groups.
Common warning signs include a gradual scree curve that tempts an arbitrary elbow, a component whose loading pattern changes greatly across reasonable resamples, or a visualization that changes substantially when one additional PC is included. A further pitfall is to discard a component just because its loadings resemble a technical signature. The correction is to treat these signals as prompts for investigation: check the analysis purpose, stability, score patterns, and relevant biological context. No single diagnostic can certify a PC as either useful or useless.
The main alternative to a combined diagnostic is a fixed rule, such as retaining a preset number of PCs or enough PCs to exceed a chosen cumulative-variance percentage. Fixed rules are simple and reproducible, and can be reasonable when justified for a specific workflow. Their limitation is that they ignore the scree shape, stability, and meaning of the components in a particular dataset. Conversely, choosing components only by inspecting gene names invites subjective selection. A transparent decision records multiple diagnostics and acknowledges that the chosen dimension is purpose-dependent.
Check Your Understanding
Answer each question, then compare your reasoning with the brief solutions below.
- A scree plot has no distinct elbow. What should you do instead of claiming that one exact PC count is objectively correct?
- Two fits produce loading vectors with correlation \(-0.91\) for a matched component. How should the sign-invariant similarity be interpreted?
- Why can a component with high explained variance still be a poor choice for a particular visualization?
- Adjacent PCs have similar eigenvalues and individual loading correlations are low across fits. What additional stability comparison may be appropriate?
- Why should the number of PCs chosen for a visualization not automatically be used for clustering?
Solutions. (1) Use a candidate range, compare scree and cumulative variance, and examine stability and loading patterns; report the purpose and uncertainty of the choice. (2) Its absolute correlation is \(0.91\), indicating similar directions despite the arbitrary sign flip. (3) High variance may reflect structure irrelevant to the display goal, including technical variation; variance alone does not establish biological usefulness. (4) Compare the combined subspaces, for example through principal angles, because near-tied components can rotate while their subspace remains stable. (5) The visualization and clustering tasks can value different aspects of the representation, so the clustering choice needs its own evaluation rather than inheriting a visualization cutoff.