6.2 Explained Variance Ratio, Trace Conservation, and Choosing k Principal Components
When you run PCA on a 100-dimensional dataset, it returns 100 orthogonal principal components ordered by their eigenvalues . If you keep all 100 components, you have merely rotated your coordinate system without compressing anything! How do you decide how many components to retain?
The mathematical foundation for choosing is trace conservation: because the trace of a matrix is invariant under orthogonal similarity transformations, the sum of all eigenvalues equals the total variance of the original features.
In this Article
1. Proving Trace Conservation: tr(C) = Σ Var(xⱼ) = Σ λⱼ
For any two matrices and of compatible dimensions, the cyclic property of the trace states that . Applying this to the spectral decomposition (where ) yields:
Geometrically, rotating a rigid cloud of points neither creates nor destroys variance: it simply redistributes the total variance across the principal axes so that the leading axes pack as much variance as possible.
2. Explained Variance Ratio (EVR) and Scree Plots
- Individual Explained Variance Ratio of Component :
- Cumulative Explained Variance Ratio of Top Components:
SCREE PLOT (Eigenvalue vs. Component Index k):
lambda_k ^
12.0 | * (PC1: Big signal)
8.0 | * (PC2: Big signal)
2.0 | * <-- "Elbow" at k = 2 or 3
0.5 | * * * * * (Noise floor: flat tail of tiny eigenvalues)
+-------------------------------> Component k
1 2 3 4 5 6 7 8
3. Practical Rules for Selecting k in Machine Learning and Science
- Cumulative Variance Threshold (e.g., , , or ): Choose the smallest such that . In
scikit-learn, passing a floatPCA(n_components=0.95)automatically selects this . - Scree Plot Elbow (Cattell's Criterion): Plot versus and truncate where the steep cliff of signal eigenvalues transitions into a flat rubble ("scree") of background noise.
- Kaiser Criterion (for Standardized Correlation PCA): When all features are standardized to variance (so and the average eigenvalue is ), retain components with (components that explain more variance than a single original variable).
4. Worked 5D Scree Table and Reconstruction Error Calculation
Suppose a 5D dataset has diagonal covariance entries (so ), and its eigenvalues are .
| Component | Eigenvalue | Individual | Cumulative | Relative Reconstruction Error |
|---|---|---|---|---|
| 1 | ||||
| 2 | ||||
| 3 | ||||
| 4 | ||||
| 5 |
If our engineering target is variance retention (or relative squared reconstruction error), we select components, capturing of the variance while compressing storage by .
5. Active Recall Check and Key Takeaways
Quick Check: Test Your Understanding
Question: You run PCA on a standardized correlation matrix of features (so every feature has variance ). Without computing a single eigenvalue, what is the exact sum of all 12 eigenvalues?
Answer: By trace conservation, .
- Trace Conservation: holds for every symmetric covariance matrix.
- Dual Meaning of : The uncaptured variance fraction equals the relative mean squared reconstruction error.
- Canonical References: See Wikipedia Reference on Scree Plots.
Take a Quiz Based on This Article
Test your understanding with AI-generated questions tailored to this content
Adaptive Learning with SynLearn
Explore this article through guided practice that adapts to your answers