Tutorials › Multivariate Statistics (Graduate) › Sample Size Planning for Principal Directions

PCA Inference and Asymptotics · Tutorial 528 of 975

Sample Size Planning for Principal Directions

Use the eigenvalue gaps and the asymptotic variability of sample covariance to translate a desired angular accuracy for a principal direction into an approximate sample size.

Advanced 10 min read

What You'll Learn

  • Express the first-order error of a sample eigenvector in the population eigenbasis
  • Calculate asymptotic angular variance for general data and for Gaussian data
  • Convert an RMS angular-error target into a sample-size approximation
  • Use a normal approximation to plan for a specified probability of meeting an angular target
  • Recognize how small eigenvalue gaps and non-Gaussian fourth moments change a plan
  • Check the assumptions and limitations behind asymptotic sample-size calculations

Why Plan for a Principal Direction?

A sample eigenvector is an estimate of a population direction, but its accuracy depends on more than the number of observations. In particular, a direction is difficult to estimate when its eigenvalue is close to a neighboring eigenvalue: the data then provide relatively little separation between the corresponding directions. Sample-size planning makes this dependence explicit, so that a target angular accuracy can be related to eigenvalue gaps and sampling variability.

The calculations below are first-order approximations, not guarantees of finite-sample performance. They are useful for comparing designs and establishing a starting sample size. A small estimated gap, a heavy-tailed distribution, or a required high probability of success may call for a more cautious plan.

First-Order Angular Error

Let \(X_1,\ldots,X_n\) be independent and identically distributed random vectors in fixed dimension \(p\), with mean \(\mu\), covariance matrix \(\Sigma\), and finite fourth moments. Write the eigenvalues of \(\Sigma\) in decreasing order as \(\lambda_1\ge\cdots\ge\lambda_p\), with corresponding orthonormal eigenvectors \(u_1,\ldots,u_p\). Fix an index \(r\) for which \(\lambda_r\) is simple: \(\lambda_r\ne\lambda_s\) for every \(s\ne r\). Let \(\hat u_r\) be a unit eigenvector of the sample covariance matrix for the corresponding sample eigenvalue.

Because an eigenvector and its negative represent the same direction, use the sign-invariant angle \(\alpha_r=\arccos(|\hat u_r^\top u_r|)\), which lies between zero and \(\pi/2\). The first-order displacement of \(\hat u_r\) lies in directions orthogonal to \(u_r\). Its coordinate in direction \(u_s\) is driven by the sample covariance entry connecting \(u_s\) and \(u_r\), divided by their population eigenvalue gap.

Definition: For \(s\ne r\), define \(v_{sr}=\operatorname{Var}([(u_s^\top(X-\mu))(u_r^\top(X-\mu))])\). The first-order angular variance coefficient for direction \(r\) is \(A_r=\sum_{s\ne r}v_{sr}/(\lambda_r-\lambda_s)^2\). The first-order mean-square approximation is \(E[\alpha_r^2]\approx A_r/n\), and the corresponding root-mean-square angular error is approximately \(\sqrt{A_r/n}\). The variance terms exist under the stated fourth-moment condition.

Deriving the Gap-Weighted Variance

The key calculation is an eigenvector perturbation. Let \(\hat\Sigma\) be the sample covariance and write \(E_n=\hat\Sigma-\Sigma\). For a symmetric matrix with a simple eigenvalue, the first derivative of its unit eigenvector, with sign chosen so that \(\hat u_r^\top u_r\ge 0\), has the form \(\sum_{s\ne r}u_s(u_s^\top E_nu_r)/(\lambda_r-\lambda_s)\). Here is the derivation that identifies both the gap and the random quantity in the formula.

1
Expand the eigenvector.
For a small symmetric perturbation \(E\), write the perturbed eigenvector as \(u_r+h\) to first order, with \(u_r^\top h=0\), and its eigenvalue as \(\lambda_r+\eta\).
2
Keep first-order terms.
In \((\Sigma+E)(u_r+h)=(\lambda_r+\eta)(u_r+h)\), subtract \(\Sigma u_r=\lambda_ru_r\) and discard products of perturbations. The result is \(Eh+\!Eu_r\) only at higher order, so the first-order equation is \(\Sigma h+Eu_r=\lambda_r h+\eta u_r\).
3
Project onto another eigenvector.
Multiply by \(u_s^\top\), where \(s\ne r\). Since \(u_s^\top u_r=0\), this gives \((\lambda_s-\lambda_r)u_s^\top h+u_s^\top Eu_r=0\).
4
Read off each coordinate.
Thus \(u_s^\top h=(u_s^\top Eu_r)/(\lambda_r-\lambda_s)\). Summing these orthogonal coordinates gives the first-order direction displacement.

For the sample covariance, the entry \(u_s^\top E_nu_r\) is, to first order, the sample average of centered products. In detail, put \(Y_{is}=u_s^\top(X_i-\mu)\). The covariance entry in the population eigenbasis is the sample covariance of the \(Y\)'s, and its population value is zero for \(s\ne r\). Estimating the mean rather than using \(\mu\) changes this entry only by a product of sample-mean errors, which is of smaller order than \(n^{-1/2}\). Therefore \[ \sqrt n\,u_s^\top E_nu_r =\frac{1}{\sqrt n}\sum_{i=1}^n Y_{is}Y_{ir}+o_p(1). \]

Each product has mean zero because \(u_s^\top\Sigma u_r=0\). The multivariate central limit theorem applies to the vector of these products: its coordinates have finite second moments because \(X\) has finite fourth moments. The eigenvector perturbation formula is differentiable at a simple eigenvalue, so the delta method gives the following asymptotic result.

Theorem: Under the independent, identically distributed, fixed-\(p\), finite-fourth-moment assumptions above, and for a simple \(\lambda_r\), the sign-aligned eigenvector has the first-order expansion \[ \sqrt n(\hat u_r-u_r) = \sum_{s\ne r}u_s\, \frac{1}{\sqrt n}\sum_{i=1}^n \frac{Y_{is}Y_{ir}}{\lambda_r-\lambda_s} +o_p(1). \] Consequently, the limiting covariance of its tangent coordinates has diagonal entries \(v_{sr}/(\lambda_r-\lambda_s)^2\), and the limiting expected squared tangent length, as a first-order variance calculation, is \(A_r\).

To see the variance calculation directly, each summand \(Y_{is}Y_{ir}\) has mean zero and variance \(v_{sr}\). The coefficient along \(u_s\) consequently has asymptotic variance \(v_{sr}/(\lambda_r-\lambda_s)^2\). Since the \(u_s\)'s are orthonormal, the squared length of the tangent displacement is the sum of the squared coordinates; covariance between distinct coordinates does not contribute to that squared length's expectation. For small displacements, angular error equals tangent length to first order, since \(\sin(\alpha_r)\approx\alpha_r\).

The theorem is a distributional, first-order statement. Using \(A_r/n\) as an approximation to the actual finite-sample mean-square error additionally relies on the usual mean-square regularity of the approximation; convergence in distribution alone does not establish convergence of second moments. Sample-size calculations below are explicitly asymptotic planning approximations.

Planning for a Root-Mean-Square Target

Suppose the desired root-mean-square angular error is at most \(\delta\) radians. Substituting the first-order approximation gives \(\sqrt{A_r/n}\le\delta\), or \(n\ge A_r/\delta^2\). The smallest integer meeting this approximate threshold is the ceiling of the quotient. Angles in these formulas are in radians.

Worked Example: Gaussian Leading Direction in Three Dimensions

Assume \(X\sim N_3(\mu,\Sigma)\) with eigenvalues \(9,4,1\). Plan for an RMS angular error of at most \(0.05\) radians for the leading direction \(u_1\).

For Gaussian coordinates in the population eigenbasis, \(Y_s\) and \(Y_r\) are independent when \(s\ne r\). Their product has variance \(E[Y_s^2]E[Y_r^2]=\lambda_s\lambda_r\). Thus \(A_1=9(4)/(9-4)^2+9(1)/(9-1)^2\).

The two contributions are \(36/25=1.44\) and \(9/64=0.140625\), so \(A_1=1.580625\). Since \(\delta^2=0.0025\), \(A_1/\delta^2=1.580625/0.0025=632.25\). Rounding up gives an approximate RMS-target choice of \(n=633\). This is a first-order threshold, not a claim that 633 observations ensure the target in every realized sample.

The Gaussian simplification is useful but not universal. In general, the variance of a product of principal-coordinate scores depends on their joint fourth moments, not just on their variances. A plan based on eigenvalues alone can therefore misrepresent uncertainty when the data are not Gaussian.

Worked Example: A Non-Gaussian Product Variance

Construct a two-dimensional centered distribution as follows. Let \(R^2\) equal \(0.5\) or \(1.5\), each with probability \(1/2\), and let \(\varepsilon_1,\varepsilon_2\) be independent random signs, independent of \(R\), each equally likely to be \(+1\) or \(-1\). Set \(X_1=\sqrt5R\varepsilon_1\) and \(X_2=\sqrt2R\varepsilon_2\).

Both means are zero. Also \(E[R^2]=(0.5+1.5)/2=1\), so \(\operatorname{Var}(X_1)=5\) and \(\operatorname{Var}(X_2)=2\). The covariance is zero because the independent signs give \(E[\varepsilon_1\varepsilon_2]=0\). Thus the population eigenvalues are \(5\) and \(2\), with leading direction \(u_1=(1,0)^\top\).

The product is \(X_1X_2=\sqrt{10}R^2\varepsilon_1\varepsilon_2\), with mean zero. Further, \(E[R^4]=(0.5^2+1.5^2)/2=1.25\), so \(\operatorname{Var}(X_1X_2)=E[X_1^2X_2^2]=10(1.25)=12.5\). Consequently \(A_1=12.5/(5-2)^2=12.5/9\approx1.388889\).

For an RMS target of \(0.08\) radians, \(\delta^2=0.0064\), and the quotient is \(1.388889/0.0064\approx217.014\). The approximate rounded-up choice is \(n=218\). Had the Gaussian formula been used with these same eigenvalues, its coefficient would be \(5(2)/9=10/9\approx1.111111\), which is smaller: the shared random scale \(R\) increases the product variance.

Gaps and Probability-Based Targets

Every contribution to \(A_r\) is divided by a squared eigenvalue gap. This means a neighboring eigenvalue can dominate the plan even if other eigenvalues are well separated. In addition to RMS planning, a design may specify a probability target, such as requiring the angle to be below \(\delta\) with probability about \(0.95\). The asymptotic distribution can translate that request into a sample size, provided the limiting covariance is known or credibly estimated.

Worked Example: A Small Gap Changes the RMS Plan

Compare two Gaussian two-dimensional populations for their leading direction, using an RMS target of \(0.1\) radians. In the first, the eigenvalues are \(4\) and \(3.5\). The Gaussian coefficient is \(A_1=4(3.5)/(4-3.5)^2=14/0.25=56\), so \(n\approx56/0.01=5600\).

In the second population, the eigenvalues are \(4\) and \(2\). Now \(A_1=4(2)/(4-2)^2=8/4=2\), giving \(n\approx2/0.01=200\). The leading eigenvalue is unchanged, but the smaller gap in the first population produces a coefficient 28 times as large. This is why a planning calculation should include the relevant gap, not merely the scale of the leading eigenvalue.

In two dimensions there is only one tangent coordinate. Under the asymptotic normal approximation, the sign-invariant angle is approximately the absolute value of a mean-zero normal variable with variance \(A_r/n\). A two-sided probability target can then be planned using a normal quantile. In higher dimensions, the tangent vector is multivariate normal in the limit, and the probability target depends on the distribution of its norm; it is not generally obtained by applying a one-dimensional normal quantile to the RMS.

Worked Example: Approximately 95% Within an Angular Tolerance

For a Gaussian two-dimensional population with eigenvalues \(4\) and \(2\), the leading-direction coefficient is \(A_1=4(2)/(4-2)^2=2\). Seek an approximate 95% probability that the sign-invariant angle is no more than \(0.1\) radians.

The asymptotic angle is approximately \(|Z|\sqrt{2/n}\), where \(Z\sim N(0,1)\). Since \(P(|Z|\le1.96)\approx0.95\), require \(1.96\sqrt{2/n}\le0.1\). Squaring both positive sides gives \(n\ge 2(1.96/0.1)^2=2(19.6)^2=2(384.16)=768.32\). The approximate rounded-up choice is \(n=769\). The RMS calculation for the same tolerance would give only \(n\ge2/0.01=200\); these are different criteria, and the probability target is more demanding.

Assumptions, Pitfalls, and Practical Use

These formulas assume a fixed dimension, independent observations from a stable population, a simple target eigenvalue, and finite fourth moments for the asymptotic covariance calculation. They do not directly handle a repeated eigenvalue: within a repeated eigenspace, an individual eigenvector is not uniquely defined, and its gap denominator vanishes. In that setting the estimand must be an eigenspace rather than a single direction.

  • Using the gap instead of its square. The first-order coordinate error divides by \(\lambda_r-\lambda_s\), so its variance divides by \((\lambda_r-\lambda_s)^2\).
  • Assuming Gaussian product variances for all data. Outside the Gaussian case, calculate or estimate \(v_{sr}\) from fourth moments or use a justified model for them.
  • Treating an RMS target as a probability guarantee. The RMS criterion and the requirement of a specified probability within an angular tolerance are not interchangeable.
  • Ignoring uncertainty in planning inputs. Population gaps and fourth moments are usually unknown. Pilot estimates can be unstable, especially near a small gap; sensitivity calculations across plausible values are prudent.
  • Reading a first-order threshold as an exact sample size. Approximation error, finite-sample behavior, and model misspecification may matter. A safety margin or simulation under plausible models can be appropriate.

The practical value of the calculation is its diagnostic clarity: it separates the role of the eigenvalue geometry from the role of sampling variation. A direction with a large gap and modest product variance may require relatively few observations, while a near-tie can demand far more. Reporting the assumed gaps, variance coefficient, angular tolerance, and planning criterion makes the resulting sample-size recommendation interpretable and auditable.

Key takeaway: For a simple population eigenvector, first-order angular variance is a sum of product variances divided by squared eigenvalue gaps. For an RMS target \(\delta\), the corresponding planning approximation is \(n\approx A_r/\delta^2\); probability targets require the limiting distribution of the full angular displacement.

Check Your Understanding

Use the definitions and approximations above to answer these questions.

  1. Why does a small gap between \(\lambda_r\) and a neighboring eigenvalue increase angular uncertainty?
  2. For non-Gaussian data, what quantity replaces \(\lambda_r\lambda_s\) in the variance contribution for directions \(r\) and \(s\)?
  3. If the first-order coefficient is \(A_r=3\), what RMS angular error is predicted at \(n=300\)?
  4. Why does a 95% probability target within an angle generally require a different calculation from an RMS target?
  5. What fails when the target population eigenvalue is repeated, and what kind of estimand is more suitable?
Clinical Biostats