Dimensions methodology: how Portfolio Lab counts independent risks
The Dimensions tab on the Risk page answers the question of how many mutually independent risks a portfolio contains and how this changes over time. It decomposes the correlation matrix of the positions into its eigenvalues, compares them with the bound for pure randomness, counts the effective bets at the portfolio's weights and tracks these measures on a rolling basis without look-ahead. This page describes what the code in core/dimensions.py actually calculates.
Data and estimation
The basis is the same data as on the rest of the Risk page: monthly returns of completed months in the base currency from the settings, for all positions over their common period, at the target weights of the selected portfolio (positive weights only, scaled to 100%). The period is the entire common history or the last 36, 60 or 120 months; at least 24 common months and at least two positions are required. A position that does not fluctuate at all during the period stops the calculation with a notice, because without fluctuation there is no correlation.
As in the risk decomposition, the code estimates the covariance matrix Σ as a sample covariance, as an EWMA with decay factor λ (default 0.97 per month, half-life 22.8 months) or with Ledoit-Wolf shrinkage towards a scaled identity target (Ledoit and Wolf 2004). From Σ it derives the correlation matrix C = D^−½ Σ D^−½, with the variances on the diagonal of D. A benchmark plays no role for the dimensions.
Spectrum and noise threshold
The eigenvalues λ₁ ≥ … ≥ λ_N of the correlation matrix sum to the number of positions N; λₖ/N is the share of total variance carried by the k-th dimension. Each dimension is an eigenvector, i.e. a direction in which the positions move together. The loadings table shows up to the first six dimensions; because the sign of an eigenvector is arbitrary, the code flips each one so that the sum of its loadings is positive, and names the three largest loadings in absolute terms for each dimension.
The yardstick is the band in which the eigenvalues of purely random correlations lie (Marchenko and Pastur (1967); for stocks Laloux et al. (1999)). Eigenvalues above the upper bound count as dimensions with signal (Marchenko-Pastur distribution).
q = N / T, λ₋ = (1 − √q)², λ₊ = (1 + √q)²- N
- number of positions
- T
- number of months in the period; for EWMA, the effective number 1 / Σaₜ² of the weights aₜ
- λ₊
- noise threshold: eigenvalues above it count as signal
The bound holds strictly for the sample correlation of many independent, identically distributed series; with few positions it is a rule of thumb. For EWMA, the code uses the effective number of months. This is an approximation. Ledoit-Wolf pulls the eigenvalues towards the middle, so the count tends to be conservative. With fewer than twice as many months as positions, a notice appears; with at most as many months as positions, the correlation matrix (except with Ledoit-Wolf) is not invertible, and at least N − T + 1 eigenvalues are zero.
Effective number of bets
Following Meucci (2009), the code decomposes the covariance matrix into its principal components Σ = E Λ Eᵀ and writes the portfolio as a mix of the principal component portfolios, w̃ = Eᵀw. Each contributes the share pₖ = λₖ w̃ₖ² / wᵀΣw to the variance; the shares are never negative and sum to 1. The effective number of bets is exp(−Σ pₖ ln pₖ): 1 if one component carries everything, N with N equal shares. If two eigenvalues of the covariance matrix are less than 1% apart, the direction of the components is barely determined; a notice then appears.
The minimum torsion bets following Meucci et al. (2013) look for uncorrelated factors F = tR that stay as similar as possible to the positions: t minimises Σₙ Var((Fₙ − Rₙ)/σₙ) subject to the factors being uncorrelated. Written in terms of the correlation, t = σ · diag(d) · O · C^−½ · σ⁻¹ with an orthogonal matrix O. Like Meucci's “exact” procedure, the code alternates between O = (dCd)^−½ · d · C^½ (the orthogonal part of the polar decomposition) and d = diag(O · C^½), starting with d = 1, until the relative change in d is at most 10⁻¹² (at most 10,000 steps). The shares pₙ = b̃ₙ² Var(Fₙ) / wᵀΣw with b̃ = t⁻ᵀw each belong to one position, are never negative and sum to 1; from them, the count is again exp(−Σ pₙ ln pₙ). If the smallest eigenvalue of the correlation matrix is not greater than 10⁻¹⁰, minimum torsion stays empty.
There is one peculiarity: if two positions move almost identically, each still keeps its own factor. Minimum torsion then splits the common risk between the two and counts them as separate bets. The shares are close to the Euler contributions. With two positions with a correlation of 0.999 and a third, independent one, all equally volatile and equally weighted, minimum torsion counts 2.87 bets and the principal components 1.65. From a correlation of 0.95 between two positions, a notice points this out.
Alongside are two measures without a decomposition: the effective number of weights 1 / Σwᵢ² (Herfindahl index) and the diversification ratio Σwᵢσᵢ / σ_p following Choueifaty and Coignard (2008), the same as in the Positions tab.
Absorption ratio and history
The absorption ratio following Kritzman et al. (2011) is the share of the k largest eigenvalues in the sum of all eigenvalues, with k = ⌈N/5⌉ and at least 1. Kritzman et al. use the covariance; Portfolio Lab uses the correlation so that highly volatile positions do not determine the measure on their own. The spectrum and the absorption ratio thus count every position equally, while the bets are weighted by the portfolio.
On a rolling basis, the code calculates the effective number of bets (both kinds), the dimensions with signal and the absorption ratio in windows of 24 to 120 months (in steps of 6, default 36) over the entire common history, with the same covariance estimate, today's target weights and, for each window, only the months up to its end. The history appears once at least the window length plus 12 months of data are available. If the window has at most as many months as positions, minimum torsion stays empty in the history.
Limitations
- Backward-looking: all measures are estimates from past monthly returns. Correlations change, and in crises they often rise at the same time.
- Monthly data: daily returns would provide more observations but would be offset for exchanges in different time zones; asset classes are only available monthly.
- Normal-distribution view: the spectrum and the bets are based on variances and covariances; they do not capture tail dependence.
- Twins: minimum torsion counts positions that move almost identically as separate bets; as a number of independent risks, the count by principal components is then closer.
- Not a return measure: more dimensions do not mean more return.
Frequently asked questions
Why does the spectrum use the correlation instead of the covariance?
So that every position counts equally. With the covariance, a highly volatile equity position would almost single-handedly determine the first dimension, even if it has little to do with the other positions. The effective number of bets, on the other hand, uses the covariance and the weights, because it decomposes the portfolio's risk.
Why do the bets by principal components and by minimum torsion differ?
Principal components are abstract directions that mainly order the variance; minimum torsion looks for uncorrelated twins of the individual positions. For uncorrelated positions with different volatilities the two agree; otherwise they can differ considerably.
What does a rising absorption ratio mean?
The largest dimensions absorb more of the total variance: the positions move more closely together, and diversification protects less. It does not tell you when losses will occur.
Why is minimum torsion sometimes empty?
It needs an invertible correlation matrix. That is not the case with at most as many months as positions, or with two positions that move almost identically.
How many months do I need for reliable dimensions?
The code calculates with at least 24 months; the noise threshold only becomes meaningful when the months clearly outnumber the positions. With ten positions and 60 months it is 1.98.
Literature
- Choueifaty, Yves; Coignard, Yves (2008): Toward Maximum Diversification. The Journal of Portfolio Management 35 (1), pp. 40–51. doi:10.3905/jpm.2008.35.1.40
- Kritzman, Mark; Li, Yuanzhen; Page, Sébastien; Rigobon, Roberto (2011): Principal Components as a Measure of Systemic Risk. The Journal of Portfolio Management 37 (4), pp. 112–126. doi:10.3905/jpm.2011.37.4.112
- Laloux, Laurent; Cizeau, Pierre; Bouchaud, Jean-Philippe; Potters, Marc (1999): Noise Dressing of Financial Correlation Matrices. Physical Review Letters 83 (7), pp. 1467–1470. doi:10.1103/PhysRevLett.83.1467
- Ledoit, Olivier; Wolf, Michael (2004): Honey, I Shrunk the Sample Covariance Matrix. The Journal of Portfolio Management 30 (4), pp. 110–119. doi:10.3905/jpm.2004.110
- Marčenko, V. A.; Pastur, L. A. (1967): Distribution of eigenvalues for some sets of random matrices. Mathematics of the USSR-Sbornik 1 (4), pp. 457–483. doi:10.1070/SM1967v001n04ABEH001994
- Meucci, Attilio (2009): Managing Diversification. Risk 22, pp. 74–79. Source
- Meucci, Attilio; Santangelo, Alberto; Deguest, Romain (2013): Risk Budgeting and Diversification Based on Optimized Uncorrelated Factors. SSRN Working Paper 2276632. doi:10.2139/ssrn.2276632
This page describes how Portfolio Lab calculates; past results are not a forecast. All terms in the glossary.