Tutorials › Multivariate Statistics (Graduate) › Selecting the Number of Factors from Eigenvalues

High-Dimensional PCA and Factors · Tutorial 867 of 975

Selecting the Number of Factors from Eigenvalues

Learn how eigenvalue ratios and thresholds estimate factor dimension, when they are consistent, and how weak signals, clustered eigenvalues, and zero eigenvalues affect the decision.

Advanced 11 min read

What You'll Learn

  • Define eigenvalue-ratio and spectral-threshold estimates of factor dimension.
  • State asymptotic conditions under which each rule consistently estimates the number of factors.
  • Handle zero eigenvalues by restricting ratio candidates to positive denominators.
  • Relate a Marchenko–Pastur edge threshold to detectable outlier eigenvalues.
  • Diagnose failures caused by weak, clustered, or poorly separated factors.

Why Factor Dimension Is a Spectral Question

In a large panel, principal component methods identify common variation through the leading eigenvalues of the sample covariance matrix. Estimating the number of factors is therefore not just a matter of locating a visible elbow: the decision depends on how signal eigenvalues compare with one another and with the noise spectrum. Two common approaches are the eigenvalue-ratio rule, which looks for a large adjacent drop, and the spectral-threshold rule, which counts eigenvalues above a chosen level.

Let \(x_t\in\mathbb{R}^p\), for \(t=1,\ldots,n\), denote centered panel observations, and let \(S\) be their sample covariance matrix. Write its ordered eigenvalues as \(\hat\lambda_1\geq\hat\lambda_2\geq\cdots\geq\hat\lambda_p\geq0\). The unknown factor dimension is \(q\). In a pervasive-factor setting, the leading \(q\) population eigenvalues typically grow with \(p\), while the remaining eigenvalues stay bounded. The sample eigenvalues inherit this separation under suitable sampling and noise conditions.

Definition: Given a candidate range \(1\leq k\leq K\leq p-1\), the eigenvalue-ratio estimate is $$ \hat q_{\mathrm{ER}}=\min\mathop{\arg\max}_{k\in\mathcal C}\frac{\hat\lambda_k}{\hat\lambda_{k+1}}, \qquad \mathcal C=\{k:1\leq k\leq K,\ \hat\lambda_{k+1}>0\}. $$ The minimum specifies how to break ties. If \(\mathcal C\) is empty, the estimate is undefined and must be reported as such; it is not assigned an arbitrary factor count. A spectral-threshold estimate, for a specified threshold \(\tau_n>0\), is $$ \hat q_{\mathrm{TH}}=\sum_{j=1}^{p}\mathbf{1}\{\hat\lambda_j>\tau_n\}. $$

The ratio definition deliberately excludes zero denominators. This matters in high dimensions: \(S\) can be rank deficient, especially when \(p\) exceeds the number of centered observations. A ratio such as \(0/0\) has no value, and a positive eigenvalue divided by zero is not a finite candidate ratio. An implementation should use only indices in \(\mathcal C\), rather than silently treating these cases as ordinary ratios. For consistency, the candidate range must include \(q\), and the denominator at \(q\) must be positive with probability tending to one.

Worked Applications of the Rules

Worked Example: A Clear Adjacent-Eigenvalue Drop

Suppose the five largest sample eigenvalues are \(12, 8, 1.2, 1.0,\) and \(0.9\), and take \(K=4\). The adjacent ratios are $$ \frac{12}{8}=1.5,\qquad \frac{8}{1.2}=6.\overline{6},\qquad \frac{1.2}{1.0}=1.2,\qquad \frac{1.0}{0.9}=1.\overline{1}. $$ The largest ratio is at \(k=2\), so \(\hat q_{\mathrm{ER}}=2\).

If the chosen threshold is \(\tau_n=3\), exactly \(12\) and \(8\) exceed it, and \(\hat q_{\mathrm{TH}}=2\) as well. Agreement is reassuring in this example, but the two procedures use different information: one compares neighboring eigenvalues, while the other compares each eigenvalue with an external level.

Worked Example: Restricting Ratios in a Rank-Deficient Spectrum

Suppose \(p=6\), there are only four centered observations, and the sample eigenvalues are \(9,4,1,0,0,0\). The covariance rank is at most \(4-1=3\), as the listed spectrum confirms. With \(K=5\), the only admissible ratio indices are \(k=1,2\): their denominators are \(4\) and \(1\), both positive. The ratios are $$ \frac{9}{4}=2.25,\qquad \frac{4}{1}=4. $$ Thus the ratio rule selects \(k=2\). The indices \(k=3,4,5\) are excluded because their denominators are zero; in particular, \(1/0\) and \(0/0\) are not valid candidates.

This calculation shows both the benefit and the limitation of the restriction. A factor count of two is available from these eigenvalues, but a factor count at or beyond the rank boundary cannot be resolved by adjacent ratios with positive denominators. The candidate range should be chosen with the attainable rank in mind.

Worked Example: Comparing an Edge-Based Threshold and Ratios

Take \(p/n\) close to \(1\), with unit-variance independent noise. The Marchenko–Pastur upper edge for the noise spectrum is \((1+\sqrt{1})^2=4\). Suppose the leading sample eigenvalues are \(25,12,3.8,3.5,3.2\), and use \(K=3\). The ratios are $$ \frac{25}{12}\approx2.08,\qquad \frac{12}{3.8}\approx3.16,\qquad \frac{3.8}{3.5}\approx1.09. $$ The ratio rule chooses \(k=2\). If the threshold is \(4.2\), slightly above the edge to allow for sampling variation, the threshold rule also counts two eigenvalues.

The edge value \(4\) is justified here only under the stated identity-noise and aspect-ratio model. If the noise variance is \(\sigma^2\), the edge becomes \(\sigma^2(1+\sqrt{p/n})^2\). With correlated or otherwise structured noise, this particular formula need not apply.

Conditions for Consistency

A consistency statement must specify what happens to the signal eigenvalues, the noise eigenvalues, and the candidate ratios as \(p\) and \(n\) grow. The following conditions isolate the spectral requirements; they can be verified from a factor model using appropriate concentration results. Assume throughout that the true factor count \(q\) is fixed and \(q\leq K\), where \(K\) is a fixed candidate maximum.

Theorem (Consistency of the eigenvalue-ratio rule): Suppose that with probability tending to one, every denominator \(\hat\lambda_{k+1}\), \(1\leq k\leq K\), is positive. Suppose also that $$ \frac{\hat\lambda_q}{\hat\lambda_{q+1}}\xrightarrow{p}\infty, \qquad \max_{\substack{1\leq k\leq K\\k\ne q}} \frac{\hat\lambda_k}{\hat\lambda_{k+1}}=O_p(1). $$ Then \(\hat q_{\mathrm{ER}}\xrightarrow{p}q\).

The first condition says the drop after the last factor grows without bound. The second rules out a competing adjacent drop of comparable size elsewhere in the candidate range. In a pervasive-factor model, a common sufficient spectral pattern is that \(\hat\lambda_q\) grows proportionally to \(p\), \(\hat\lambda_{q+1}=O_p(1)\), and all other candidate ratios remain bounded in probability. The ratio conditions are substantive: divergence after \(q\) alone does not prevent a still larger drop among earlier eigenvalues.

Proof. Let \(R_k=\hat\lambda_k/\hat\lambda_{k+1}\) for \(1\leq k\leq K\), on the event that all denominators are positive. The hypotheses give \(R_q\to\infty\) in probability and \(\max_{k\ne q}R_k=O_p(1)\). For any \(\varepsilon>0\), choose a finite \(M\) such that, for all sufficiently large \(n\), the probability that \(\max_{k\ne q}R_k>M\) is less than \(\varepsilon/2\). Since \(R_q\to\infty\) in probability, the probability that \(R_q\leq M\) is eventually less than \(\varepsilon/2\). Outside these two events, \(R_q>M\geq R_k\) for every \(k\ne q\), so the unique maximizer is \(q\). The probability of an inadmissible denominator tends to zero by assumption. Hence \(P(\hat q_{\mathrm{ER}}=q)\to1\), which implies \(\hat q_{\mathrm{ER}}\xrightarrow{p}q\). \(\square\)

Theorem (Consistency of a diverging spectral threshold): Suppose there is a constant \(a>0\) such that \(P(\hat\lambda_q\geq ap)\to1\), and suppose \(\hat\lambda_{q+1}=O_p(1)\). If \(\tau_n\to\infty\) and \(\tau_n/p\to0\), then \(\hat q_{\mathrm{TH}}\xrightarrow{p}q\).

Proof. Since the eigenvalues are ordered, every \(\hat\lambda_j\) for \(j\leq q\) is at least \(\hat\lambda_q\). Because \(\tau_n/p\to0\), eventually \(\tau_n<ap\), so with probability tending to one all first \(q\) eigenvalues exceed the threshold. For the remaining eigenvalues, \(\hat\lambda_j\leq\hat\lambda_{q+1}\) for every \(j>q\). The condition \(\hat\lambda_{q+1}=O_p(1)\), together with \(\tau_n\to\infty\), implies \(P(\hat\lambda_{q+1}\leq\tau_n)\to1\). Thus, with probability tending to one, exactly the first \(q\) eigenvalues exceed \(\tau_n\), proving the claim. \(\square\)

These results describe two useful regimes. A threshold diverging more slowly than \(p\) separates pervasive factor eigenvalues from bounded noise eigenvalues. Alternatively, under identity noise with \(p/n\to c\in(0,\infty)\), the Marchenko–Pastur upper edge is \(\sigma^2(1+\sqrt c)^2\). A threshold just above this edge can identify sample outliers when the noise model and edge fluctuations are controlled. That fixed-edge approach is not interchangeable with the diverging-threshold theorem: it relies on a more specific noise-spectrum model and detects separated outliers, not every possible weak factor.

Weak and Clustered Factors

Both methods can fail when the spectral separation needed for their decision is absent. If a factor is weak enough that its sample eigenvalue does not separate from the noise spectrum, a threshold placed above the noise edge will not count it. For a fixed-spike identity-noise model, the BBP transition describes when a population spike produces a separated sample outlier; below the transition, the leading sample eigenvalue remains at the bulk edge asymptotically. A ratio rule can also fail in this setting: without a diverging or otherwise dominant ratio at the true \(q\), random gaps within the bulk may determine its maximizer.

Clustered factors create a different difficulty. If two adjacent factor eigenvalues are nearly equal, their ratio is near one, so the ratio rule has no large gap between them. The rule can still consistently find \(q\) if the drop after the entire factor cluster dominates all other candidate ratios, but small finite-sample gaps can make the selected index unstable. A threshold may count both clustered factors if both are above it; it may miss one if the weaker eigenvalue lies near or below the threshold. Thus neither method can recover a dimension reliably without assumptions that make the desired distinction observable.

Worked Example: A Weak Signal Can Be Hidden at the Noise Edge

Consider a unit-variance identity-noise model with \(p/n\) close to \(1\), whose noise upper edge is approximately \(4\). Suppose a weak population factor produces no separated sample outlier, and a possible observed leading spectrum is \(4.1,3.9,3.7,3.4\). With \(K=3\), the adjacent ratios are $$ \frac{4.1}{3.9}\approx1.051,\qquad \frac{3.9}{3.7}\approx1.054,\qquad \frac{3.7}{3.4}\approx1.088. $$ The ratio rule selects \(k=3\), while a threshold of \(4.2\) selects zero eigenvalues. Neither calculation demonstrates that the true factor count is three or zero: it shows that, for this weak-signal spectrum, the two rules yield different decisions and neither has a clear spectral separation to support recovery.

The example is a finite-spectrum illustration, not a claim that these four values are the unique or typical limit for a weak factor. The relevant diagnosis is the absence of a pronounced gap and the proximity of the leading values to the noise edge.

Practical Choice and Common Pitfalls

The eigenvalue-ratio rule is attractive when pervasive factors create a sharp drop after the signal eigenvalues and the competing ratios are controlled. It avoids selecting a threshold in the eigenvalue units of the data. Its weakness is that its answer depends on the candidate range and on all ratios within that range. A very small denominator can create an enormous ratio, and a rank-deficient tail can make some ratios undefined.

A spectral threshold makes the decision rule explicit and can be tied to a noise model. Its reliability depends on calibrating that threshold to the noise spectrum, including its scale and any dependence structure. A threshold that is too low counts noise eigenvalues; one that is too high discards weak factors. In applications, report the candidate range or threshold, the estimated spectrum, and whether the selected count is stable to reasonable changes in these choices.

Common mistake: Maximizing \(\hat\lambda_k/\hat\lambda_{k+1}\) over every \(k\leq p-1\) assumes every denominator is positive. That is false for rank-deficient sample covariance matrices, where it can produce division by zero or \(0/0\). Restrict the maximization to indices with positive denominators, specify what happens if there are no eligible indices, and ensure the true \(q\) is eligible for the intended consistency claim.

The central question is not which rule is universally superior, but whether the assumptions behind its separation are plausible. A diverging signal-to-noise gap supports either a ratio rule or a suitably diverging threshold. A calibrated bulk edge supports outlier counting under its model. Weak signals, clustered eigenvalues, rank limitations, and misspecified noise can all remove that support.

Check Your Understanding

Use the definitions and conditions above to check your reasoning.

  1. Why must a ratio candidate with \(\hat\lambda_{k+1}=0\) be excluded, and what should be reported if no candidates remain?
  2. State the two ratio-separation conditions used to establish consistency when \(q\) and \(K\) are fixed.
  3. Why does a threshold satisfying \(\tau_n\to\infty\) and \(\tau_n/p\to0\) separate eigenvalues of order \(p\) from bounded noise eigenvalues?
  4. Under what noise assumptions is the Marchenko–Pastur upper edge a meaningful threshold reference?
  5. Explain why a weak factor at the noise edge can be missed by a threshold and fail to generate a decisive adjacent ratio.
Clinical Biostats