Back to Docs
T
Traderoid

Rolling PCA Node

Principal Component Analysis - dimensionality reduction and correlation structure

StatisticalDimensionalityMultivariate

Overview

Rolling PCA (Principal Component Analysis) decomposes the correlation matrix of multiple assets to find principal drivers and factors. PCA eigenvalues tell you what fraction of variance each principal component explains. PCA eigenvectors identify which assets co-move and how. Rolling PCA tracks how correlation structure evolves over time.

Use Rolling PCA to: (1) reduce portfolio dimensionality for cleaner signals, (2) detect when correlations break down, (3) identify concentrated risk in few factors, (4) build factor models grounded in actual correlation structure. First principal component (highest eigenvalue) typically captures "market beta"—all assets moving together.

Formula & Calculation

Rolling PCA Computation
1. Compute rolling correlation matrix Corr(t)
2. Eigenvalue decomposition: λ₁ ≥ λ₂ ≥ ... ≥ λₙ
3. Eigenvectors v₁, v₂, ... = principal directions
λ₁ = variance explained by 1st component
Σλᵢ / n = total variance (normalized to 1 for correlation)
Interpretation
PC1 eigenvalue 0.8 = 80% of variance in single factor
PC1 eigenvalue 0.3 = very dispersed correlations
Eigenvector loadings = asset weights in component

Parameters

ParameterDefaultDescription
lookback60-252Rolling correlation window
n_components2-5Number of principal components

Common Use Cases

1. Correlation Breakdown Detection

Track PC1 eigenvalue: sharp drop signals correlation structure breakdown. When PC1 drops from 0.75 to 0.45, assets no longer co-move. Trigger hedge rebalancing or model retuning. Critical for pairs trading.

2. Portfolio Simplification

If PC1 explains 75% of portfolio variance, reduce to single "market" factor + small correction factors. Simplifies models and improves out-of-sample stability. Capture 90% of variance with 2-3 components instead of 20 stocks.

3. Risk Concentration

High PC1 eigenvalue means concentrated risk: "all eggs in one basket". Eigenvector loadings show which assets drive concentration. Low concentration (similar eigenvalues) = balanced exposure. Guides diversification.

4. Factor Model Building

Use PC1, PC2 as "natural" factors from correlation structure instead of forcing arbitrary factor definitions. PC1 = market beta, PC2 = rotational risk. More robust than ad-hoc factor definitions.

Advantages & Limitations

Advantages

  • Data-driven factors
  • Dimensionality reduction
  • Identifies correlations
  • Robust decomposition
!

Limitations

  • Computationally intensive
  • Backward looking
  • Sensitive to outliers
  • Interpretation challenging

Related Nodes