Finance — High-Dimensional Portfolios
Python · scikit-learn · R (corpcor, quadprog) ·
Download stock data
When the Optimiser Becomes an Error-Maximiser
Shrinking the Factor Zoo ended on an honest cliffhanger: with 20 diversified factors over 60 years, penalisation bought parsimony but not performance, because that problem is not high-dimensional. This is the regime where shrinkage stops being optional — and it runs on the Risk & Asset Allocation section's own data, 48 US stocks at weekly frequency.
The task is the minimum-variance portfolio, subject to , solved by . It is chosen deliberately: it depends only on the covariance, never on expected returns, so it isolates the covariance-estimation problem cleanly. The catch is . With 48 assets it holds 1,176 free parameters, and a one-year estimation window supplies only 52 observations. The sample covariance is then barely invertible, amplifies whatever noise it contains, and the "optimal" portfolio takes enormous offsetting long/short bets that have nothing to do with real risk — Markowitz's optimiser turned into an error-maximiser (Michaud, 1989).
Where the estimate stops existing
One boundary is worth stating precisely, because it is easy to dramatise incorrectly. A covariance estimated from observations has rank at most , so for it is exactly singular and the minimum-variance portfolio does not exist. Solvers do not always say so: at a 30-week window the matrix has rank 29 and a condition number around , and solve() returns a confident-looking answer built from floating-point noise. Those windows are therefore excluded here rather than plotted. The genuine deterioration is dramatic enough without them — out-of-sample volatility runs from 12% at a long window to 61% as approaches , while shrinkage stays flat near 13% throughout.
| estimation window | N/T | rank of Σ̂ | condition number | status |
|---|---|---|---|---|
| 30 weeks | 1.60 | 29 | 1.6×10¹⁸ | singular — portfolio undefined |
| 48 weeks | 1.00 | 47 | 7.5×10¹⁶ | singular — portfolio undefined |
| 52 weeks (1 year) | 0.92 | 48 | 5.0×10⁴ | invertible, badly conditioned |
| 150 weeks | 0.32 | 48 | 9.2×10² | invertible, well conditioned |
The Horse Race
A rolling backtest — one-year window, re-estimated weekly, everything strictly out of sample — over five portfolios: sample minimum-variance, Ledoit–Wolf shrinkage, a ridge (L2) covariance, the long-only portfolio whose no-short constraint acts as implicit L1 (Jagannathan & Ma, 2003), and equal-weight 1/N.
| method | OOS volatility (the objective) | OOS Sharpe | gross leverage | turnover |
|---|---|---|---|---|
| sample minimum-variance | 46.0% — error-maximiser | −0.07 | 15.1× | 7.85 |
| Ledoit–Wolf shrinkage | 15.5% | 0.36 | 2.2× | 0.33 |
| ridge (L2) covariance | 16.3% | 0.21 | 2.7× | 0.48 |
| long-only sparse (L1) | 15.0% | 0.73 | 1.0× | 0.20 |
| equal-weight 1/N | 20.5% | 0.70 | 1.0× | 0.00 |
The sample portfolio carries 15× gross leverage and 46% out-of-sample volatility — three times the shrunk estimators, at ten times the leverage and twenty times the turnover. Every form of shrinkage or constraint collapses both to sane levels. The long-only portfolio reaches the lowest volatility while holding only about a dozen of the 48 stocks, at the lowest turnover of any optimised method: the no-short constraint is not merely stabilising, it is selecting.
Is the edge over 1/N real?
The result that needed testing rather than asserting is the comparison with 1/N. On Sharpe the sparse portfolio's 0.73 against 1/N's 0.70 looks like a win. A paired bootstrap over the 259 weeks puts the gap at +0.028 with a 95% interval of [−0.58, +0.61], and it comes out ahead in 53% of resamples — a coin flip. DeMiguel, Garlappi & Uppal's finding survives the test: with zero estimation and no optimisation whatsoever, 1/N matches every one of these estimators on risk-adjusted return.
But Sharpe is not what these portfolios optimise — they minimise variance and never estimate a single expected return. Judged on their own objective the verdict reverses and is unambiguous: against 1/N the sparse portfolio's volatility advantage is −5.5 percentage points with a 95% interval of [−8.3, −2.8], comfortably clear of zero, and its tie with Ledoit–Wolf (−0.5pp, interval straddling zero) is a genuine tie. Shrinkage buys lower risk, not higher return per unit of it — and an estimator should be judged on the quantity it was built to control.
Two estimators, one number
A cross-engine detail that looks like a bug and is not. In R, corpcor::cov.shrink and the ridge covariance report the same volatility to two decimals — 16.2554 against 16.2616 — yet they are different portfolios, their weekly returns correlating 0.979. Both are linear shrinkage toward a diagonal target, so converging is unsurprising. scikit-learn's Ledoit–Wolf, with a different target, reaches 15.5%. The choice of shrinkage target matters more than the choice of package.
Where this sits
This closes the loop the factor example opened: shrinkage's payoff scales with dimensionality, and portfolio construction is where it becomes indispensable. It is the frequentist twin of Shrinkage Estimation of Mean and Covariance, Bayesian Estimation & Estimation Risk and The Black–Litterman Model, which treat this same instability with a prior rather than a penalty — and, since the long-only constraint selects assets exactly as the Lasso selects factors, of the Variable Selection arc.
Notebooks
Downloads
References
- Ledoit, O. & Wolf, M. (2004). A well-conditioned estimator for large-dimensional covariance matrices. Journal of Multivariate Analysis 88(2), 365–411. — the shrinkage estimator used here
- Michaud, R. O. (1989). The Markowitz optimization enigma: is 'optimized' optimal? Financial Analysts Journal 45(1), 31–42. — the error-maximiser diagnosis
- Jagannathan, R. & Ma, T. (2003). Risk reduction in large portfolios: why imposing the wrong constraints helps. Journal of Finance 58(4), 1651–1683. — the no-short constraint as implicit shrinkage
- DeMiguel, V., Garlappi, L. & Uppal, R. (2009). Optimal versus naive diversification. Review of Financial Studies 22(5), 1915–1953. — the 1/N benchmark tested above
- Brodie, J., Daubechies, I., De Mol, C., Giannone, D. & Loris, I. (2009). Sparse and stable Markowitz portfolios. PNAS 106(30), 12267–12272. — L1 in portfolio construction
- Schäfer, J. & Strimmer, K. (2005). A shrinkage approach to large-scale covariance matrix estimation. Statistical Applications in Genetics and Molecular Biology 4(1). — the estimator behind R's
corpcor