Quant Analytics: from scratch to pro · Portfolio, sizing and risk metrics · Pro
Portfolio construction: mean-variance, shrinkage, risk parity
Mean-variance optimisation turns estimates of returns and covariances into weights, and magnifies their errors. Shrinkage, equal weights and risk-based weights such as inverse volatility and equal risk contribution trade a little theory for much more stability.
In this lesson
- Explain why mean-variance weights are unstable and what drives it
- Shrink a sample correlation towards a target
- Compute inverse-volatility weights and each asset's risk contribution
- Choose between equal weight, risk parity and optimisation for a given amount of data
Read first: Portfolio maths: variance, correlation and the limits of diversification, Risk-adjusted return: the Sharpe and Sortino ratios
Choosing weights for several assets looks like a maths problem with a clean answer. In practice the answer depends on inputs that are estimated with error, and the method decides whether that error is tamed or magnified. This lesson compares four families.
Mean-variance optimisation
Harry Markowitz (1952) framed the problem: for a target return, find weights with the lowest variance. The inputs are expected returns and the covariance matrix. The unconstrained solution is w ~ inverse(Sigma) x mu, scaled to sum to one. See the history.
The inverse of the covariance matrix is the trouble. When two assets are highly correlated, the optimiser sees an opportunity in their small difference and loads up on one.
Worked example: unstable weights
Two assets have equal volatility and correlation 0.9. Estimated expected returns are 5.0% and 5.5%. With equal volatilities the raw weights are proportional to mu1 - 0.9 x mu2 and mu2 - 0.9 x mu1, which are 0.0005 and 0.0100. Normalised, asset 1 gets 4.8% and asset 2 gets 95.2%.
Swap the two estimates, a half-point change well inside any estimation error, and the weights swap. The method has turned a negligible difference into a concentrated bet. Expected returns are the worst-estimated input (see standard error), and the optimiser uses them with the most leverage.
Shrinkage
Shrinkage pulls noisy estimates towards a stable target. For a sample correlation r and a target t, with shrinkage weight d:
shrunk = d x t + (1 - d) x r
A sample correlation of 0.80 with d = 0.25 towards a target of 0.30 becomes 0.675. Ledoit and Wolf (2004) proposed a linear shrinkage estimator of the covariance matrix, a combination of the sample matrix and a structured target (the identity in their paper). It is better conditioned and more accurate than the sample matrix when the number of assets is large relative to the number of observations. The same idea applies to expected returns, shrunk towards a common mean.
Equal weight
The rule w = 1/N uses no estimates at all. DeMiguel, Garlappi and Uppal (2009) compared 14 optimisation models with 1/N on seven datasets and found none consistently better out of sample in Sharpe ratio, certainty-equivalent return or turnover. Their explanation is that estimation error offsets the gains from optimising. Equal weight is not a risk-aware method, as the next section shows, but it sets a hard benchmark.
Risk-based weights
Risk-based methods ignore expected returns and use only the covariance.
Take three assets with volatilities 10%, 20% and 30% and all pairwise correlations 0.3.
- Equal weights give portfolio volatility of 15.1%. The 30% asset supplies 56.8% of the risk, the 10% asset only 12.1%. Equal capital is not equal risk.
- Inverse-volatility weights are proportional to
1/volatility: 54.5%, 27.3% and 18.2%. Portfolio volatility is 11.95%, and each asset now contributes 33.3% of the risk.
An asset's risk contribution is w_i x (Sigma w)_i / variance_p. Equal risk contribution (ERC) sets all of them equal (Maillard, Roncalli and Teiletche, 2010), the idea behind risk parity. When every pairwise correlation is the same, ERC weights are exactly the inverse-volatility weights, which is why they match above. With different correlations ERC needs a numerical solution.
Risk-based weights are stable, but they have no view on return and often hold more in low-volatility assets, so they can need leverage to reach a return target. Leverage brings its own risk.
Common mistakes
- Feeding historical average returns into an optimiser and reading the weights as a recommendation.
- Optimising many assets on a short history. Estimation error grows with the number of assets.
- Ignoring constraints and turnover: optimal weights that move every month cost real trading costs.
- Treating risk parity as safe. Leverage and correlation changes can hurt it (see portfolio maths).
- Comparing methods in sample. Judge them out of sample, with costs.
In practice
Start with the simple benchmarks (equal and inverse-volatility weights), then ask whether an optimiser improves on them out of sample after costs. Use shrunk covariances, cap the weights, and rebalance on a schedule or a band. See asset allocation.
Worked numbers
Each result is recomputed from the formula shown.
| What | Formula | Result |
|---|---|---|
| mean-variance weight on asset 1, returns 5.0% and 5.5% | (0.05 - 0.9 * 0.055) / ((0.05 - 0.9 * 0.055) + (0.055 - 0.9 * 0.05)) | 4.8% |
| mean-variance weight on asset 2 | 1 - mv_w1 | 95.2% |
| shrunk correlation | 0.25 * 0.30 + 0.75 * 0.80 | 0.675 |
| inverse-volatility weight, volatility 10% | (1/0.1) / (1/0.1 + 1/0.2 + 1/0.3) | 54.5% |
| inverse-volatility weight, volatility 20% | (1/0.2) / (1/0.1 + 1/0.2 + 1/0.3) | 27.3% |
| inverse-volatility weight, volatility 30% | (1/0.3) / (1/0.1 + 1/0.2 + 1/0.3) | 18.2% |
| portfolio volatility, inverse-volatility weights, correlation 0.3 | sqrt(iv_w1**2 * 0.1**2 + iv_w2**2 * 0.2**2 + iv_w3**2 * 0.3**2 + 2 * 0.3 * (iv_w1 * iv_w2 * 0.1 * 0.2 + iv_w1 * iv_w3 * 0.1 * 0.3 + iv_w2 * iv_w3 * 0.2 * 0.3)) | 11.95% |
| portfolio volatility, equal weights | sqrt((0.1**2 + 0.2**2 + 0.3**2 + 2 * 0.3 * (0.1 * 0.2 + 0.1 * 0.3 + 0.2 * 0.3)) / 9) | 15.1% |
| equal weights: share of risk from the 30% asset | (1/3) * (1/3) * (0.3**2 + 0.3 * 0.3 * 0.1 + 0.3 * 0.3 * 0.2) / vol_eq**2 | 56.8% |
| equal weights: share of risk from the 10% asset | (1/3) * (1/3) * (0.1**2 + 0.3 * 0.1 * 0.2 + 0.3 * 0.1 * 0.3) / vol_eq**2 | 12.1% |
| inverse-volatility weights: share of risk from the 30% asset | iv_w3 * (iv_w1 * 0.3 * 0.3 * 0.1 + iv_w2 * 0.3 * 0.3 * 0.2 + iv_w3 * 0.3**2) / vol_iv**2 | 33.3% |
Check yourself
Three assets have volatilities 10%, 20% and 30%. What are the inverse-volatility weights?
Inverse volatilities 10, 5 and 3.33 sum to 18.33. The weights are 54.5%, 27.3% and 18.2%.
A sample correlation of 0.80 is shrunk with weight 0.25 towards a target of 0.30. What is the result?
0.25 x 0.30 + 0.75 x 0.80 = 0.675.
Why does an equal-weight portfolio of assets with different volatilities concentrate risk?
An asset's risk contribution grows with its volatility. The most volatile asset supplies most of the portfolio's risk, even at an equal weight.
Two assets have equal volatility and correlation 0.9. Changing one expected return by half a percentage point moves the optimiser from about 5% in an asset to about 95%. What does that show?
The optimiser bets on the small difference between near-identical assets, which in a sample is mostly noise. Its output is unstable.
When is equal weighting hard to beat?
When the sample is short relative to the number of assets, so that return and covariance estimates are noisy. Optimisation needs enough data to pay for its estimation error.
Key terms
Checked facts
Every figure below carries how it was checked: Primary checked (read in the cited primary, official, academic or data source), Two sources agree, or Approximate (an order of magnitude only).
- Primary checked
DeMiguel, Garlappi and Uppal compared 14 optimisation models with the 1/N rule on seven datasets and found none consistently better out of sample in Sharpe ratio, certainty-equivalent return or turnover.
Sources
- Portfolio Selection. Journal of Finance, vol. 7, no. 1, pp. 77-91 (Harry Markowitz), 1952
- A well-conditioned estimator for large-dimensional covariance matrices. Journal of Multivariate Analysis 88(2), 365-411 (Olivier Ledoit, Michael Wolf), 2004. Accessed 9 Nov 2026
- Optimal Versus Naive Diversification: How Inefficient is the 1/N Portfolio Strategy?. The Review of Financial Studies 22(5), 1915-1953 (Victor DeMiguel, Lorenzo Garlappi, Raman Uppal), 2009. Accessed 9 Nov 2026
- The Properties of Equally Weighted Risk Contribution Portfolios. The Journal of Portfolio Management 36(4), 60-70 (Sebastien Maillard, Thierry Roncalli, Jerome Teiletche), 2010. Accessed 9 Nov 2026