Tutorials › Multivariate Statistics (Graduate) › Likelihood-Ratio Tests for the Number of Components

PCA Inference and Asymptotics · Tutorial 518 of 975

Likelihood-Ratio Tests for the Number of Components

Learn how to test whether the covariance eigenvalues beyond a proposed retained dimension share a common value, and how to interpret the resulting likelihood-ratio statistic.

Advanced 12 min read

What You'll Learn

  • State the Gaussian covariance hypothesis for a proposed number of retained components
  • Derive the constrained maximum-likelihood estimate by pooling the trailing sample eigenvalues
  • Calculate the likelihood-ratio statistic from the trailing eigenvalues
  • Identify the asymptotic chi-square degrees of freedom and its regularity conditions
  • Distinguish a test of equal trailing eigenvalues from a test of zero trailing eigenvalues

Why Test Whether Trailing Eigenvalues Are Equal?

In population principal component analysis, a proposed retained dimension \(k\) can be assessed by asking whether the remaining \(p-k\) covariance eigenvalues are all equal. Under this hypothesis, the directions outside the leading \(k\)-dimensional subspace have a common variance: they do not exhibit further covariance structure that distinguishes one trailing direction from another. The question is statistical, not merely descriptive: observed sample eigenvalues vary even when their population counterparts are equal.

The likelihood-ratio test compares an unrestricted Gaussian covariance model with one in which the trailing population eigenvalues are constrained to be equal. Its statistic pools the trailing sample eigenvalues and measures how much fit is lost by doing so. The resulting test concerns equal trailing variances; it does not assert that those variances are zero.

Definition: Let \(X_1,\ldots,X_n\) be independent observations from \(N_p(\mu,\Sigma)\), with unknown mean \(\mu\) and positive-definite covariance matrix \(\Sigma\). For a proposed retained dimension \(k\), where \(1\le k<p\), set \(r=p-k\). The null hypothesis is that \(\Sigma\) has \(k\) eigenvalues greater than a common value \(\tau>0\), and its remaining \(r\) eigenvalues equal \(\tau\). The alternative allows an unrestricted positive-definite covariance matrix.

Write the ordered eigenvalues of the sample covariance matrix as \(s_1\ge \cdots\ge s_p>0\), where \(S=n^{-1}\sum_{j=1}^n(X_j-\bar X)(X_j-\bar X)^\mathsf{T}\). We use the maximum-likelihood divisor \(n\). The usual finite-sample calculation below assumes \(n>p\), so that \(S\) is positive definite with probability one under the Gaussian model. The common trailing estimate under the null will be the arithmetic mean of \(s_{k+1},\ldots,s_p\).

Deriving the Likelihood-Ratio Statistic

The likelihood ratio is the largest likelihood under the null divided by the largest likelihood under the unrestricted alternative. After maximizing over the unknown mean, the likelihood for a covariance matrix is proportional to \(|\Sigma|^{-n/2}\exp\{-n\,\operatorname{tr}(S\Sigma^{-1})/2\}\). Under the unrestricted alternative, the maximum-likelihood estimate is \(S\).

Under the null, the covariance eigenvectors are not fixed in advance. For any fixed set of covariance eigenvalues, aligning the eigenvectors of \(\Sigma\) with those of \(S\) in the same order minimizes \(\operatorname{tr}(S\Sigma^{-1})\). This follows from the trace rearrangement inequality. With that alignment, the first \(k\) covariance eigenvalues can be estimated as \(s_1,\ldots,s_k\). The common trailing value \(\tau\) is estimated by maximizing the likelihood over the remaining block.

Result: Define \(\bar s_{\mathrm{tail}}=r^{-1}\sum_{i=k+1}^p s_i\). The null maximum-likelihood covariance has eigenvalues \(s_1,\ldots,s_k,\bar s_{\mathrm{tail}},\ldots,\bar s_{\mathrm{tail}}\), with the trailing value repeated \(r\) times. The likelihood ratio and its conventional test statistic are
$$ \Lambda = \left( \frac{\prod_{i=k+1}^{p}s_i} {\bar s_{\mathrm{tail}}^{\,r}} \right)^{n/2}, \qquad T=-2\log\Lambda = n\left[ r\log(\bar s_{\mathrm{tail}}) -\sum_{i=k+1}^{p}\log(s_i) \right]. $$

To verify the constrained estimate, let \(u\) be the common trailing covariance eigenvalue. The terms of the negative twice log-likelihood that depend on \(u\), apart from constants, are \(n\{r\log u+(\sum_{i=k+1}^p s_i)/u\}\). Differentiating with respect to \(u\) gives \(n\{r/u-(\sum_{i=k+1}^p s_i)/u^2\}\), which vanishes at \(u=\bar s_{\mathrm{tail}}\). The second derivative there is \(nr/\bar s_{\mathrm{tail}}^{\,2}>0\), so this is the minimum of the negative log-likelihood. Also \(s_k\ge s_{k+1}\ge \bar s_{\mathrm{tail}}\), so the estimate respects the required ordering.

At this estimate, the trace term is \(\sum_{i=1}^k s_i/s_i+\sum_{i=k+1}^p s_i/\bar s_{\mathrm{tail}}=k+r=p\). It is also \(p\) at the unrestricted estimate \(S\). The exponential likelihood factors therefore cancel, leaving the determinant ratio displayed above. By the arithmetic-geometric mean inequality, \(\bar s_{\mathrm{tail}}^{\,r}\ge\prod_{i=k+1}^p s_i\); hence \(0<\Lambda\le1\) and \(T\ge0\), as a likelihood-ratio statistic must.

Worked Example: Two Trailing Eigenvalues

Suppose \(p=4\), \(k=2\), \(n=100\), and the sample covariance eigenvalues are \(8,5,2.4,1.6\). The trailing count is \(r=2\), and their pooled estimate is \(\bar s_{\mathrm{tail}}=(2.4+1.6)/2=2\).

The likelihood-ratio statistic is \(T=100\{2\log 2-\log(2.4)-\log(1.6)\}\). Since \(2.4\times1.6=3.84\) and \(2^2=4\), this becomes \(T=100\log(4/3.84)=100\log(25/24)\approx4.082\). Thus \(\Lambda=\exp(-T/2)\approx0.130\). The test has not established that the two population eigenvalues differ; the statistic must be assessed against its null distribution.

Asymptotic Reference Distribution

For this test, the asymptotic degrees of freedom are not simply the number of pairwise equalities among the trailing eigenvalues. The equality constraint leaves the trailing eigenspace free to rotate, and that freedom affects the dimension of the covariance restriction. Under the regularity conditions below, the null distribution of \(T\) is asymptotically chi-square.

Theorem: Suppose \(p\) is fixed, \(n\to\infty\), and the observations are independent from \(N_p(\mu,\Sigma)\). Under the null, suppose the \(r=p-k\) trailing population eigenvalues all equal \(\tau>0\), and the \(k\) leading eigenvalues are strictly greater than \(\tau\). Then \(T\xrightarrow{d}\chi^2_d\), where \(d=r(r+1)/2-1\).

Here is a derivation. Work in population eigenvector coordinates, so that the trailing population block is \(\tau I_r\). The Gaussian covariance central limit theorem implies that the trailing \(r\times r\) block of \(\sqrt n(S-\Sigma)/\tau\) converges to a symmetric Gaussian matrix \(A\) whose diagonal entries are independent \(N(0,2)\), whose entries above the diagonal are independent \(N(0,1)\), and whose distinct upper-triangular entries are independent. The fixed gap between the leading eigenvalues and \(\tau\) separates the trailing cluster. Consequently, the trailing sample eigenvalues have first-order deviations \(n^{-1/2}\tau\) times the eigenvalues of \(A\). In particular, after subtracting their average, their squared deviations satisfy

$$ \frac{n}{\tau^2}\sum_{i=k+1}^{p}(s_i-\bar s_{\mathrm{tail}})^2 \ \xrightarrow{d}\ \left\|A-\frac{\operatorname{tr}(A)}{r}I_r\right\|_F^2. $$

This first-order statement follows by expressing the sample covariance in leading and trailing blocks. The off-diagonal blocks are \(O_p(n^{-1/2})\); because the population blocks are separated by a fixed eigenvalue gap, their effect on the trailing eigenvalues is second order, \(O_p(n^{-1})\). The first-order trailing eigenvalue changes are therefore the eigenvalues of the trailing block fluctuation.

It remains to expand the logarithms in \(T\). Put \(\delta_i=s_i-\bar s_{\mathrm{tail}}\) for the trailing indices. Then \(\sum\delta_i=0\), and each \(\delta_i=O_p(n^{-1/2})\). A Taylor expansion around \(\bar s_{\mathrm{tail}}\), which converges in probability to \(\tau>0\), gives \(\sum\log(s_i)=r\log(\bar s_{\mathrm{tail}})-\sum\delta_i^2/(2\bar s_{\mathrm{tail}}^2)+o_p(n^{-1})\). The cubic remainders are \(O_p(n^{-3/2})\) because \(r\) is fixed. Thus \(T=n\sum\delta_i^2/(2\bar s_{\mathrm{tail}}^2)+o_p(1)\).

Finally, the traceless symmetric matrices form a space of dimension \(r(r+1)/2-1\). In an orthonormal coordinate system for the Frobenius inner product, the Gaussian matrix \(A\) has independent standard-normal coordinates after the scaling implicit in \(\|A\|_F^2/2\). Projecting out its trace removes one coordinate, so \(\|A-\operatorname{tr}(A)I_r/r\|_F^2/2\) has a chi-square distribution with \(r(r+1)/2-1\) degrees of freedom. Combining this fact with the expansion proves the theorem. \(\square\)

The degrees of freedom reflect the dimension of the restriction on the trailing symmetric covariance block: it has \(r(r+1)/2\) free entries, and imposing that it be a scalar multiple of the identity leaves one free scalar. Their difference is \(r(r+1)/2-1\). This explains why counting only the apparent equality among ordered eigenvalue values can give the wrong reference distribution.

Worked Example: Testing a Three-Dimensional Trailing Cluster

Let \(p=5\), \(k=2\), and \(n=60\). Suppose the sample eigenvalues are \(9,6,3,2,1\). The trailing mean is \(\bar s_{\mathrm{tail}}=(3+2+1)/3=2\), so

\(T=60\{3\log 2-\log3-\log2-\log1\}=60\log(8/6)=60\log(4/3)\approx17.261\).

Here \(r=3\), so the degrees of freedom are \(3(4)/2-1=5\). The 5% upper critical value for \(\chi^2_5\) is approximately \(11.07\). Since \(17.261>11.07\), this sample rejects the hypothesis of equal trailing population eigenvalues at the 5% level under the stated Gaussian model and asymptotic approximation.

Worked Example: Exactly Equal Sample Tails

Suppose \(p=4\), \(k=1\), \(n=80\), and the sample eigenvalues are \(7,2,2,2\). Here \(r=3\), and the trailing mean is \(2\). Therefore \(T=80\{3\log2-(\log2+\log2+\log2)\}=0\), so \(\Lambda=1\).

Pooling the trailing eigenvalues causes no loss in likelihood when those sample eigenvalues are already equal. The asymptotic degrees of freedom are still \(3(4)/2-1=5\); they are determined by the hypothesis and not by the observed statistic.

Interpreting the Test for PCA Dimension

For a proposed \(k\), a small p-value is evidence against the model in which all directions after the first \(k\) have a common population variance. This provides one inferential check on a retained dimension. It is not a direct test that the covariance has rank \(k\): the null common value \(\tau\) is positive, and the trailing directions retain variance. Nor does failure to reject prove equality; it means the data did not provide sufficient evidence against the specified null at the chosen significance level.

A practical analysis may examine more than one proposed \(k\), but those tests should not be treated as independent conclusions or as an automatic rule for selecting dimension. The statistic is calibrated for a specified null and Gaussian sampling assumptions. Its chi-square reference is asymptotic, so small samples or violations of normality can make that approximation unreliable.

Common Mistakes

  • Using the wrong tail summary. The null maximum-likelihood estimate pools trailing eigenvalues by their arithmetic mean. The likelihood ratio compares their product with the corresponding power of that mean.
  • Using \(r-1\) degrees of freedom. This overlooks the covariance structure of the trailing block and its free eigenspace orientation. The asymptotic degrees of freedom are \(r(r+1)/2-1\).
  • Calling this a test of zero residual variance. The null specifies a common positive trailing eigenvalue, not a zero eigenvalue or a rank-\(k\) covariance matrix.
  • Treating non-rejection as proof. A non-significant result is not proof that trailing population eigenvalues are equal; it may also reflect limited information or an inaccurate approximation.
Key takeaway: For a proposed retained dimension \(k\), pool the \(r=p-k\) trailing sample eigenvalues, calculate \(T=n\{r\log(\bar s_{\mathrm{tail}})-\sum_{i=k+1}^p\log s_i\}\), and compare it asymptotically with \(\chi^2_{r(r+1)/2-1}\) under the stated Gaussian and eigenvalue-gap conditions.

Check Your Understanding

Work through these questions using the definitions and derivation above.

  1. For \(p=6\) and proposed dimension \(k=3\), what is the number of trailing eigenvalues, and what are the asymptotic degrees of freedom?
  2. Why is the constrained estimate of the common trailing variance the arithmetic mean rather than the geometric mean?
  3. What does a small likelihood-ratio p-value say about the proposed retained dimension? What does it not say about the trailing variances?
  4. Explain why \(r-1\) is not the correct asymptotic degrees of freedom for this test.
  5. If all observed trailing sample eigenvalues are identical, what are \(\Lambda\) and \(T\)?
Clinical Biostats