Finance quantitative · QP convexe · LP
Moyenne–variance et valeur à risque conditionnelle
La variance est commode. C’est la queue gauche qui fait mal. L’un de ces modèles est un programme quadratique ; l’autre est linéaire.
À actifs et rendement cible identiques, cette page compare l’optimisation moyenne–variance classique (programme quadratique convexe) et la valeur à risque conditionnelle de Rockafellar–Uryasev (programme linéaire). La covariance est d’abord rétrécie à la Ledoit–Wolf avant d’être transmise au solveur, et des jeux de crise montrent comment les deux frontières efficientes et les compositions peuvent diverger. Les jeux de crise conservent par défaut le rendement espéré de l’échantillon calme.
- PROBLÈME OPÉRATIONNEL
- La variance pénalise aussi les gains; la CVaR isole la perte espérée dans les pires scénarios de queue.
- DÉCISIONS COMPARÉES
- Résoudre un programme quadratique moyenne–variance et un programme linéaire CVaR de Rockafellar–Uryasev avec mêmes rendements et objectif.
- INDICATEURS
- Comparer frontière, perte de queue et positions sur les jeux calmes et de crise.
A mean–variance investor pays for variance, including upside variance. A CVaR investor pays for the expected loss in the worst \(1-\alpha\) of scenarios. When returns are roughly elliptical, the two answers often agree. When they are skewed or heavy-tailed, they need not.
The modelling punchline is not that one number is morally better. It is that the tail model remains a linear programme, so it will still be solvable later with integer trading constraints, whereas a cardinality-constrained Markowitz model would be a mixed-integer quadratic programme that this lab’s solver cannot take.
All bundled return packs are labelled illustrative skeletons of generic books. They are not official index histories.
VOIR LA FORMULATION MATHÉMATIQUE
Markowitz as a convex QP
Let \(x\) be portfolio weights, \(\mu\) the vector of expected returns, and \(\hat\Sigma\) a positive definite covariance. For a target \(R\):
\[ \min_x \tfrac12 x^\top\hat\Sigma x \quad\text{s.t.}\quad \mu^\top x \ge R,\quad \mathbf{1}^\top x = 1,\quad x_i \ge \underline{x}. \]The default teaching model has no short sales (\(\underline{x}=0\)). The Hessian passed to HiGHS is \(Q=\hat\Sigma\), and the shared solver compiles this as \(\tfrac12 x^\top Q x\), so the quadratic term is neither doubled nor halved. \(\hat\Sigma\) is a Ledoit–Wolf shrinkage of the sample covariance towards a constant-correlation target, then a tiny ridge if needed so the smallest eigenvalue is at least \(10^{-8}\). A “raw sample” toggle is available to show the pathology of a noisy Hessian.
The target grid runs up to the largest single-asset mean under the long-only bound. A requested target below the risk-minimising return is kept: the return constraint goes slack and the page returns that risk-minimising portfolio, rather than calling the solve infeasible.
CVaR as an LP
CVaR here is of loss \(L_s=-r_s^\top x\), not of return. Following Rockafellar and Uryasev (2000), a threshold \(\zeta\) (VaR at optimality) and slacks \(u_s\ge 0\) give
\[ \min_{x,\zeta,u}\; \zeta + \frac{1}{1-\alpha}\sum_{s=1}^{S} p_s u_s \quad\text{s.t.}\quad u_s \ge L_s-\zeta,\quad \mu^\top x \ge R,\quad \mathbf{1}^\top x=1,\quad x_i\ge\underline{x}. \]If the pack does not supply weights, \(p_s=1/S\). Axes and the reading line are in loss units (also shown with a simple annualisation for comparison with the target, without compounding).
Sandbox
- Mean–variance expected return (annualised)
- 0.08
- CVaR expected return (annualised)
- 0.08
- Mean–variance volatility (annualised)
- 0.059
- CVaR volatility (annualised)
- 0.062
- Mean–variance CVaR (annualised)
- 0.918
- CVaR portfolio CVaR (annualised)
- 0.9
At annualised target 0.08, mean–variance return is 0.08 and CVaR-portfolio return is 0.08. CVaR of loss at α = 0.95 is 0.9182 versus 0.8996. Largest weight difference: EQ4 at -0.1843.
| Quantity | Mean–variance | CVaR |
|---|---|---|
| Status | Optimal | Optimal |
| Expected return (annualised) | 8% | 8% |
| Volatility (annualised) | 5.9329% | 6.1956% |
| CVaR of loss (annualised) | 91.8203% | 89.9596% |
| Checksum | pass | pass |
Vue pédagogique spatiale
Coordonnées calculées de rendement, volatilité et CVaR ; données pédagogiques, pas un conseil en investissement.
Notes and limits
- No expected-utility or higher-moment model, and no LLM-driven scenario tilt. Transaction costs and cardinality wait for the index-tracking essay.
- Crisis packs default to holding the calm-sample \(\mu\), converted into the pack’s period length so weekly and daily units are not mixed; only the scenarios and covariance come from the selected window. Unchecking that toggle re-estimates \(\mu\) on the window and says that the target grid has moved.
- If \((1-\alpha)S<1\), CVaR is still defined but is essentially worst-case loss; a warning is shown.
- Live market feeds stay disabled.
References
- Markowitz, H. (1952). Portfolio selection. The Journal of Finance, 7(1), 77–91.
- Rockafellar, R. T. and Uryasev, S. (2000). Optimization of conditional value-at-risk. Journal of Risk, 2(3), 21–41.
- Ledoit, O. and Wolf, M. (2004). Honey, I shrunk the sample covariance matrix. The Journal of Portfolio Management, 30(4), 110–119.