You Think You're Diversified? Check With Correlation
4-section structure: Concept / How We Compute / How to Read / Caveats.
1. Concept
"Don't put all your eggs in one basket." But what counts as different baskets?
Not "many stocks" — few stocks with low correlation.
If you hold TSMC, UMC, ASE, and Silergy-KY, you hold 4 different companies but essentially one semiconductor sector bet. They rise and fall together. Your "diversified" portfolio is functionally a levered semi ETF.
The correlation coefficient quantifies how similarly two stocks move:
- ρ = +1 → perfectly in sync
- ρ = 0 → unrelated
- ρ = −1 → perfectly opposite
A truly diversified portfolio has average ρ close to zero (or negative).
2. How We Compute
Input
- Watchlist / portfolio holdings
- Daily close → simple daily returns
- 252 trading-day window (configurable)
Two Correlations Side-by-Side
| Metric | Nature | Strength |
|---|---|---|
| Pearson ρ | Linear; assumes normality | Industry standard |
| Spearman ρ | Rank-based; distribution-free | Robust to extremes |
When Pearson and Spearman diverge significantly, non-linearity or outliers are present — worth attention.
Key Outputs
- Symmetric correlation matrix (diagonal = 1)
- Average ρ (upper triangle mean, excluding diagonal)
- Diversity score:
- avg ρ < 0.3 → 🟢 High
- 0.3 ≤ avg ρ < 0.6 → 🟠 Medium
- avg ρ ≥ 0.6 → 🔴 Low
- High-correlation warnings: any pair with ρ ≥ 0.85
- Max / Min pairs
TW and US Computed Separately
Different trading sessions, currencies, holiday calendars — mixing them introduces timezone bias. Shown in two matrices.
Client Cache
- Same portfolio composition not recomputed for 15 minutes
- Adding a stock triggers immediate recomputation
3. How to Read
Watchlist: Diversity Badge
Summary bar shows:
Diversity [High / Med / Low] [⚠ 3]
- Middle = avg ρ verdict
- Right red dot + number = count of high-correlation warning pairs
- Click to expand: avg ρ, sample size, warning list, max/min pairs
Portfolio: Full Heatmap
Portfolio page now shows a correlation matrix below Rolling Sharpe.
Heatmap Color Coding
- Deep red → strong positive correlation
- Deep green → strong negative (rare but valuable)
- Grey → near zero (ideal diversification)
Reading the Matrix
Look for greens and greys, not reds:
- All red → highly coupled, no real diversification
- Mixed → partial diversification
- Grey/green dominant → genuine diversification
Warning List
Below the heatmap, all pairs with ρ ≥ 0.85 are listed. These represent pairs acting as essentially one position. Consider:
- Removing one of the pair
- Treating them as a single position and rebalancing
4. Caveats
⚠️ Pearson's Two Assumptions Are Often Violated
- Linearity
- Normality
Stock returns frequently violate both. We provide Spearman alongside as a robustness check. When they diverge noticeably, tail events are likely in the data.
⚠️ Sample Length Matters
- N < 60 days → highly unstable estimates, UI shows red
⚠ Sample < 60warning - N = 252 days → industry standard, reliable
- N > 500 days → may include structural shifts; can dilute recent relationships
Default 252; user-adjustable.
⚠️ Correlation Is Not Causation
High correlation doesn't mean "A causes B." Could be:
- Same sector: both ride the same business cycle
- Same issuer: TSMC (2330) vs TSM — literally the same company
- Common factor: both react to USD index
Identify the reason before acting. Same ADR → drop one; common factor → consider hedging instead of dropping.
⚠️ Multiple Testing Problem
20 holdings → C(20,2) = 190 pairs. Even with true independence, ~10 pairs will look "significantly correlated" by chance at α = 0.05.
- 1–2 warnings may be noise
- More than 5 — seriously reconsider the portfolio
We currently don't apply multiple-testing correction (Bonferroni etc.); that's a planned enhancement.
⚠️ This Is Not Complete Risk Analysis
Correlation tells you co-movement, but not:
- Volatility magnitude
- Tail risk (correlations tend to ~1 during crashes — "correlation collapse")
- Fundamental quality (two weak stocks with low ρ don't cancel each other's weakness)
Correlation is necessary but not sufficient for diversification.
Further Reading
- Sharpe Ratio: Measuring Investment Efficiency
- Beta & Volatility: Visualizing Stock Risk
- CVaR: What Happens If You Hit the Worst 5% (coming Phase 1C)