Portfolio risk
Covariance matrix toolkit
Load a covariance or correlation matrix, or estimate one from data. Check it, repair it to the nearest valid matrix, explore its structure, stress it, and use it for parametric VaR and Monte Carlo scenarios.
Matrix
Working matrix
Load a matrix to begin.
Methodology
Conventions
- A covariance is handled as volatilities plus a correlation matrix; repairs change correlations and keep variances.
- Entries missing on one side of the diagonal are mirrored; the matrix is then symmetrised as (A + Aᵀ) / 2.
- VaR horizons scale the matrix by the square root of time from the matrix's own period (252 business days a year).
References
- Higham (2002), Computing the nearest correlation matrix
- Ledoit and Wolf (2003, 2004), shrinkage estimators
- RiskMetrics Technical Document (1996)
- Jorion, Value at Risk, 3rd ed.
Formulas
- Correlation
- \rho_{ij} = \Sigma_{ij} / (\sigma_i \sigma_j)
- Positive semi-definite
- x^\top \Sigma x \ge 0 \;\forall x \iff \lambda_{min} \ge 0
- Condition number
- \kappa = \lambda_{max} / \lambda_{min}
- Nearest correlation (Higham)
- \min_X \lVert A - X \rVert_F \text{ s.t. } X \succeq 0,\ X_{ii} = 1
- Delta-normal VaR
- VaR = z_\alpha \sqrt{h\, e^\top \Sigma e}