Why the Number of Components Is a Choice
Genotype principal component analysis (PCA) orders directions of variation by how much variation they explain. The first component explains the most, the second explains the most among directions orthogonal to the first, and so on. But PCA itself does not label a component as ancestry, noise, or technical artifact. Choosing how many components to retain therefore requires evidence about the eigenvalue pattern, whether candidate patterns reproduce, and whether meaningful structure remains after retaining them.
The goal here is not to infer the number of ancestral populations. A principal component is a direction of sample variation, not necessarily a distinct ancestral group. Nor is there a universal rule that says to keep a fixed number of components or a fixed percentage of total variation. A defensible choice combines diagnostics and states what each one can and cannot establish.
Eigenvalues, Scree Plots, and Gaps
Let \(G\) be the centered and scaled genotype matrix used for PCA, with \(n\) individuals in rows and \(m\) variants in columns. For definiteness, define the sample-by-sample matrix \(C=GG^{T}/m\). Write its ordered eigenvalues as \(\lambda_1\geq\lambda_2\geq\cdots\geq 0\). The corresponding eigenvectors give the sample directions, or PC score directions. Using another consistent scaling of \(C\) changes the eigenvalue magnitudes but not their ordering or the relative variance proportions.
A scree plot is useful because it displays the whole decay pattern, not just a single summary. A sharp decline followed by a relatively flat tail may support retaining the components before the bend. Cumulative explained variation can add context: the first \(K\) components explain \(\sum_{j=1}^{K}\lambda_j/\sum_{\ell=1}^{r}\lambda_\ell\). However, a high cumulative percentage is not itself evidence that all those components represent relevant ancestry. Many small components can accumulate to a large percentage, especially when the data contain broad or diffuse variation.
Gaps should be judged relative to the overall spectrum. A gap of 0.2 may be prominent in one data set and unremarkable in another. Inspect both absolute differences and the relative decline, such as \(\lambda_j/\lambda_{j+1}\), and compare the proposed boundary with the surrounding tail. Close eigenvalues deserve special care: their individual eigenvectors can be unstable or rotate into one another, even when their joint subspace is reproducible.
Worked Example: Reading an Eigenvalue Elbow
Suppose a hypothetical genotype PCA gives the first eight eigenvalues \(9.00, 4.00, 1.60, 1.45, 1.35, 1.25, 1.15, 1.05\), with the remaining eigenvalues smaller and forming a gradual tail. Assume the matrix was formed consistently across the analysis, the samples and variants passed the intended quality checks, and no one sample dominates the leading components.
The successive differences among the displayed eigenvalues are \(5.00, 2.40, 0.15, 0.10, 0.10, 0.10,\) and \(0.10\). The large drop from PC2 to PC3, followed by much smaller drops, suggests an elbow after PC2. The relative ratio at that boundary is \(4.00/1.60=2.50\), whereas the next ratio is \(1.60/1.45\approx1.10\). This supports investigating \(K=2\), rather than treating every displayed component as equally strong.
The sum of the eight displayed eigenvalues is \(20.85\). The first two account for \(9.00+4.00=13.00\), or \(13.00/20.85\approx0.6235\), about 62.4% of the variation represented by these eight components. This is not the total explained proportion if further eigenvalues exist; the denominator for the full proportion must include all nonzero eigenvalues. The elbow is evidence for a candidate cutoff, not a decision by itself. Reproducibility and residual checks are still needed.
Check Whether Candidate Structure Reproduces
A potentially meaningful component should not depend entirely on a fragile choice of samples or variants. Reproducibility can be assessed by repeating PCA under reasonable perturbations of the analysis, such as analyzing independent subsets of variants or resampling individuals and comparing results on the individuals shared between runs. The perturbation must be chosen with the study design in mind: a split that removes a relevant group or leaves too few variants may make a comparison uninformative.
PC signs are arbitrary: multiplying an eigenvector and all its scores by \(-1\) produces the same component. Therefore, a correlation of \(-0.95\) between two matched score vectors can indicate strong agreement just as a correlation of \(0.95\) can. When eigenvalues are close, matching individual PCs by order can also be misleading. In that case, compare the subspaces spanned by the first \(K\) score directions. One standard summary uses principal angles: if \(Q_A\) and \(Q_B\) are orthonormal bases for two candidate \(K\)-dimensional subspaces, the singular values of \(Q_A^{T}Q_B\) are the cosines of those angles. Values near 1 correspond to small angles and similar subspaces.
Worked Example: Comparing Candidate Subspaces
Suppose two hypothetical analyses of the same 500 individuals produce a two-component candidate subspace. One analysis uses one variant panel and the other uses a distinct panel selected for a robustness check. Assume both panels are adequate for PCA, use consistent genotype processing, and contain enough information to estimate the leading structure. The singular values of \(Q_A^{T}Q_B\) are 0.98 and 0.91.
The corresponding principal angles are \(\arccos(0.98)\approx11.5^\circ\) and \(\arccos(0.91)\approx24.5^\circ\). Both angles are below \(30^\circ\), so the two-dimensional subspaces are reasonably similar in this hypothetical comparison, although the second direction is less stable than the first. This gives support for a two-component representation, but it does not establish that both directions are ancestry rather than some other reproducible source of variation.
Now suppose the third component has a score correlation of only \(0.28\) across the two analyses after allowing for sign reversal, and its eigenvalue lies within a flat tail. That combination is weak evidence for retaining PC3 as a stable population-structure direction. The correlation alone is not a universal cutoff: its interpretation depends on sample size, the perturbation, and whether close eigenvalues make individual axes rotate.
Look for Structure Left Beyond the Proposed Cutoff
A candidate \(K\) should also be checked for patterns that remain beyond the first \(K\) components. Inspect the eigenvalue tail and, where useful, examine residual directions after removing the retained score space. If \(U_K\) is a matrix whose columns are orthonormal retained sample directions, the projected residual genotype matrix is \(R=(I-U_KU_K^{T})G\). PCA of \(R\) describes variation orthogonal to those retained directions. In the same unmodified PCA, these residual directions correspond to the remaining eigen-directions; residual analysis is useful for inspection, not a separate guarantee that the remaining variation is irrelevant.
Plot or summarize residual scores against sample information that could reveal interpretable structure, such as broad geographic labels, collection site, sequencing batch, or known sample quality measures. A residual pattern aligned with geography may indicate that the chosen \(K\) leaves ancestry-related variation. A pattern aligned with batch or quality may instead signal technical structure. These explanations are not interchangeable: a component can reflect technical variation, ancestry, or both. Investigate the data-generating context before treating a residual pattern as a reason to add an ancestry component.
Worked Example: A Residual Component and Collection Site
Suppose a hypothetical analysis retains two PCs, but the next residual PC separates two collection sites. There are 20 unrelated individuals from each site, and their residual-PC score means are \(0.42\) and \(-0.42\) score units. Assume the within-site sample standard deviations are both approximately \(0.60\) score units, and no single individual drives the separation.
The difference in site means is \(0.42-(-0.42)=0.84\) score units. Under the simplifying assumption of independent samples with equal variances, the standard error for this difference is \(0.60\sqrt{1/20+1/20}=0.60\sqrt{0.10}\approx0.190\) score units. The standardized difference is \(0.84/0.190\approx4.42\). This large descriptive separation indicates that the residual scores are strongly aligned with site in this example.
That observation is a reason to investigate, not proof that a third ancestry component is required. If site corresponds to geography, the residual pattern could reflect ancestry; if sites used different laboratory procedures, it could reflect technical variation. Inspecting genotype quality, collection metadata, and reproducibility can help distinguish these possibilities. A formal test would require an appropriate model and assumptions; the calculation here is a descriptive diagnostic, not a claim that the site effect is causal.
A Defensible Selection Workflow
Use the diagnostics as complementary evidence, not as a mechanical voting rule. The following workflow makes the judgment explicit.
Plot ordered eigenvalues, note prominent bends or gaps, and calculate cumulative explained variation for candidate values of \(K\). Record whether the tail declines smoothly or has further distinct drops.
Repeat the analysis under reasonable perturbations and compare signs-adjusted score patterns or, when axes may rotate, the candidate subspaces. Record which components are stable and which are not.
Examine residual eigenstructure and residual scores against relevant sample and technical information. Decide whether a residual pattern is interpretable, reproducible, and relevant to the analysis.
State the chosen \(K\), the evidence supporting it, plausible alternatives, and any unresolved technical or population-structure patterns. Do not describe \(K\) as the number of ancestral populations.
| Diagnostic | What it can support | What it cannot establish alone |
|---|---|---|
| Scree plot and eigenvalue gaps | A candidate boundary between stronger and weaker directions | That the leading directions represent ancestry rather than artifacts |
| Cumulative explained variation | How much of the measured variation the first \(K\) directions summarize | A universally correct percentage or cutoff |
| Reproducibility checks | Whether a component or subspace persists under reasonable perturbations | That stable variation has a biological rather than technical cause |
| Residual structure checks | Whether notable variation remains beyond the proposed \(K\) | That adding components is automatically the right remedy |
Common Mistakes, Diagnostics, and Limits
A common mistake is to say, “The first four PCs explain 80%, so I will retain four.” This uses a summary of variance as though it identified relevant ancestry. The correction is to treat cumulative variation as context, then check gaps, stability, and residual patterns. Another mistake is to call every reproducible PC an ancestry component. Reproducibility establishes persistence under the chosen perturbation, not the source of the signal. Compare the scores with study metadata and investigate technical explanations.
A flat scree plot does not necessarily mean there is no structure: gradual population gradients can lack a sharp elbow. Conversely, a clear gap does not guarantee that the components before it are free of technical effects. Individual PCs may be unstable when neighboring eigenvalues are close, even when their combined subspace is stable. A result that changes substantially when a small set of samples is removed can also signal that one group or a few influential samples dominate the apparent structure.
There are alternative strategies, including choosing \(K\) from a prespecified downstream analysis plan or using formal comparisons with an explicit noise model. Such approaches answer different questions and depend on their own assumptions; they do not make the exploratory diagnostics unnecessary. No selection rule can recover a single objectively correct \(K\) in every setting. The defensible choice depends on the study’s sampling, genotype quality, scientific purpose, and the consequences of retaining too few or too many components. Variant dependence can also affect the eigenvalue pattern and its stability; the separate issue of linkage disequilibrium pruning is addressed in the subsequent material.
Finally, do not choose \(K\) merely because it makes a later association or comparison look favorable. Selecting components based on the outcome can make downstream inferences difficult to interpret. Keep the selection rationale tied to genotype structure, quality checks, reproducibility, and the intended analysis, and report sensitivity to plausible alternative values of \(K\) when the evidence is ambiguous.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- A scree plot has a large gap after PC1 but a gradual decline thereafter. What can the gap support, and what additional evidence would help decide whether to retain PC2 or more?
- Two runs give a correlation of \(-0.94\) for a matched PC score vector. Is this poor reproducibility? Explain.
- Why can a reproducible component still represent technical variation rather than ancestry?
- After retaining \(K\) components, residual scores separate samples by laboratory batch. What should be investigated before increasing \(K\)?
- Why is a fixed cumulative-variance target not a universal rule for selecting the number of components?
Solutions. (1) The gap supports PC1 as a candidate leading direction, but does not identify its source or settle the later cutoff. Inspect the rest of the spectrum, test stability under reasonable perturbations, and check residual patterns and metadata. (2) No. Eigenvector signs are arbitrary, so a correlation near \(-1\) indicates strong agreement after sign reversal. (3) A stable laboratory or processing effect can persist across repeated analyses just as a stable ancestry pattern can; stability alone does not identify the cause. (4) Check whether batch is associated with genotype quality, sample handling, or other technical factors, and assess whether the pattern reproduces. A batch-aligned residual direction is not automatically an ancestry component. (5) The percentage summarizes variation but does not say which variation is relevant or biological. A target can retain many weak directions or omit meaningful gradual structure, depending on the data and scientific purpose.