Portfolio construction and mean variance optimisation

Premieur InstituteRead time: 18 minutes

Two asset portfolio variance, diversification, the efficient frontier, minimum variance and tangency weights, risk parity, and why estimation error dominates the answer.

Harry Markowitz's 1952 insight was that a portfolio's risk is not the average of its holdings' risks. Because assets do not move in lockstep, combining them reduces volatility below the weighted average, and the reduction depends on how they co move. Mean variance optimisation turns that insight into a procedure: given expected returns, volatilities and correlations, find the weights that deliver the most return for each level of risk.

The procedure underpins strategic asset allocation at pensions, endowments and sovereign funds, the construction of multi asset funds, and the risk budgeting of hedge fund books. It is also notorious for producing extreme, unstable portfolios when fed real world estimates, which is why practitioners surround it with constraints, shrinkage and alternatives such as risk parity.

This topic works through a two asset case with illustrative capital market assumptions for equities and bonds, where every quantity can be computed with a calculator, then shows how small changes in one input swing the optimal answer. The same formulas extend to many assets in matrix form, shown in the code at the end.

Key takeaways

  • Portfolio variance depends on weights, volatilities and the covariance between assets; with correlation below 1, portfolio volatility is below the weighted average of the volatilities.
  • Diversification removes idiosyncratic risk but not common risk: with many assets, portfolio variance converges to the average covariance.
  • The efficient frontier is the set of portfolios with the highest expected return for each level of volatility; the minimum variance portfolio sits at its left tip.
  • With a risk free asset, the best risky portfolio is the tangency portfolio, the one with the highest Sharpe ratio.
  • Risk parity sets weights so each asset contributes equally to risk; for two assets that means weights inversely proportional to volatility.
  • Optimal weights are highly sensitive to expected return inputs, so estimation error, not the optimiser, usually dominates the result.

Two asset portfolio variance

A portfolio's expected return is simply the weighted average of its holdings' expected returns. Its variance is not. For two assets, it is the sum of each weight squared times that asset's variance, plus twice the product of the weights times the covariance between them. The covariance term is where diversification lives: when correlation is below 1, the cross term is smaller than it would be if the assets moved in lockstep, and portfolio volatility falls below the weighted average volatility.

The illustrative assumptions used throughout this topic are a simple equity and bond pair: equities with an expected return of 8 percent and volatility of 16 percent, bonds with 4 percent and 6 percent, a correlation of 0.2 between them, and a risk free rate of 3 percent. These are round numbers chosen for clarity, not a forecast, though they are in the range many institutions use.

With those inputs, a 60/40 portfolio has an expected return of 6.4 percent and a volatility of 10.35 percent, against a weighted average volatility of 12 percent. The 1.65 percentage points of volatility that disappear are the free lunch of diversification: the expected return is unchanged and the risk is lower.

Two asset portfolio return and variance
E(Rp) = w1 x E(R1) + w2 x E(R2) var(Rp) = w1^2 x s1^2 + w2^2 x s2^2 + 2 x w1 x w2 x rho x s1 x s2
w1, w2
Portfolio weights, summing to 1
s1, s2
Volatilities of the two assets
rho
Correlation between the two assets; rho x s1 x s2 is their covariance
Worked example

A 60/40 equity and bond portfolio

  • Equities: expected return 8%, volatility 16%. Bonds: 4%, 6%. Correlation 0.2. All illustrative.
  • Weights: 60% equities, 40% bonds.
  1. 1. Covariance
    0.2 x 0.16 x 0.06 = 0.00192
    0.00192
  2. 2. Equity term
    0.6^2 x 0.16^2 = 0.36 x 0.0256 = 0.009216
    0.009216
  3. 3. Bond term
    0.4^2 x 0.06^2 = 0.16 x 0.0036 = 0.000576
    0.000576
  4. 4. Cross term
    2 x 0.6 x 0.4 x 0.00192 = 0.0009216
    0.0009216
  5. 5. Portfolio variance
    0.009216 + 0.000576 + 0.0009216 = 0.0107136
    0.010714
  6. 6. Portfolio volatility
    sqrt(0.0107136) = 0.1035
    10.35%
  7. 7. Expected return
    0.6 x 8% + 0.4 x 4% = 6.40%
    6.40%
  8. 8. Weighted average volatility
    0.6 x 16% + 0.4 x 6% = 12.0%
    12.0%
    Diversification saves 12.0 - 10.35 = 1.65 points of volatility.

The 60/40 portfolio expects 6.4 percent with 10.35 percent volatility, a Sharpe ratio of (6.4 - 3.0) / 10.35 = 0.33.

Diversification and its limit

Add more assets and the effect compounds, up to a point. For an equally weighted portfolio of N assets that each have volatility s and a common pairwise correlation rho, portfolio variance is s squared times (1/N plus (1 minus 1/N) times rho). As N grows, the first term, the idiosyncratic part, shrinks toward zero. The second term does not: it converges to rho times s squared, the average covariance.

The table shows this for stocks with 30 percent volatility and correlation 0.3, plausible illustrative figures for individual equities. Going from one stock to ten cuts volatility from 30 percent to about 18 percent. Going from ten to a hundred cuts it only to about 16.6 percent, and no number of such stocks gets below 16.4 percent. The remaining risk is the market, which is exactly the systematic risk that beta measures.

The practical lessons are two. First, most of the benefit of diversifying within an asset class arrives with the first few dozen holdings, which is why concentrated managers can run 20 to 40 names without carrying much idiosyncratic risk. Second, the only way to cut risk further is to add assets with lower correlation, which is the argument for multi asset portfolios. Correlations tend to rise in crises, so the diversification benefit is smallest exactly when it is most wanted.

Variance of an equally weighted portfolio
var(Rp) = s^2 x [1/N + (1 - 1/N) x rho] limit as N grows = rho x s^2
N
Number of assets, equally weighted
s
Volatility of each asset
rho
Common pairwise correlation
Volatility of an equally weighted portfolio, each asset 30% volatility, correlation 0.3 (illustrative)
Number of assetsPortfolio volatility
130.00%
224.19%
519.90%
1018.25%
3017.06%
10016.62%
Unlimited16.43%
The floor is sqrt(0.3 x 0.30^2) = 16.43 percent: the risk all the assets share.

The efficient frontier and the minimum variance portfolio

Tracing every combination of the two assets traces a curve in return and volatility space. The upper part of the curve is the efficient frontier: for each level of volatility, no other portfolio offers a higher expected return. The lower part is inefficient, because a portfolio directly above it offers more return for the same risk. The leftmost point of the curve is the minimum variance portfolio, the least volatile mix available.

For two assets the minimum variance weight has a closed form. With the illustrative inputs it puts only 6.6 percent in equities, and the resulting portfolio is less volatile than bonds alone: 5.91 percent against 6 percent. Adding a small amount of a riskier asset to a safe one can reduce total risk, because the correlation is low enough that the equity holding partly offsets bond moves. That counterintuitive result holds whenever the correlation is below the ratio of the lower volatility to the higher one, here 6/16 = 0.375.

With many assets the same problem is solved numerically, by minimising portfolio variance subject to the weights summing to one. The unconstrained solution is proportional to the inverse covariance matrix multiplied by a vector of ones. Minimum variance portfolios are popular in practice precisely because they need no expected return inputs, the most error prone ingredient.

Minimum variance weight, two assets
w1(min var) = (s2^2 - rho x s1 x s2) / (s1^2 + s2^2 - 2 x rho x s1 x s2) w2 = 1 - w1
w1
Weight in asset 1 (here equities)
s1, s2, rho
Volatilities and correlation as above
In matrix form for many assets: w = inverse(Sigma) x 1 / (1' x inverse(Sigma) x 1), where Sigma is the covariance matrix.
Worked example

Minimum variance mix of equities and bonds

  • Equity variance 0.0256, bond variance 0.0036, covariance 0.00192.
  1. 1. Numerator
    0.0036 - 0.00192 = 0.00168
    0.00168
  2. 2. Denominator
    0.0256 + 0.0036 - 2 x 0.00192 = 0.02536
    0.02536
  3. 3. Equity weight
    0.00168 / 0.02536 = 0.0662
    6.62%
  4. 4. Bond weight
    1 - 0.0662 = 0.9338
    93.38%
  5. 5. Expected return
    0.0662 x 8% + 0.9338 x 4% = 4.26%
    4.26%
  6. 6. Volatility
    two asset formula with these weights
    5.91%
    Below the 6 percent volatility of bonds alone.

The minimum variance portfolio holds about 6.6 percent equities, earns 4.26 percent and has 5.91 percent volatility, less risk than holding bonds alone and more return.

The two asset frontier: expected return, volatility and Sharpe ratio by equity weight (rf = 3%)
Equity weightExpected returnVolatilitySharpe ratio
0%4.00%6.00%0.167
10%4.40%5.93%0.236
20%4.80%6.28%0.287
30%5.20%6.98%0.315
40%5.60%7.95%0.327
50%6.00%9.09%0.330
60%6.40%10.35%0.328
70%6.80%11.69%0.325
80%7.20%13.09%0.321
90%7.60%14.53%0.317
100%8.00%16.00%0.313
Illustrative inputs: equities 8% and 16%, bonds 4% and 6%, correlation 0.2. Every row from about 7 percent equity upward lies on the efficient frontier.

The tangency portfolio and the capital market line

Once an investor can also lend or borrow at the risk free rate, the problem simplifies. Any risky portfolio can be combined with cash, and those combinations lie on a straight line from the risk free rate through the risky portfolio, with slope equal to its Sharpe ratio. The best line is the steepest one, which touches the frontier at a single point: the tangency portfolio, the risky portfolio with the highest Sharpe ratio.

This is the separation result at the heart of modern portfolio theory. Every mean variance investor should hold the same mix of risky assets, the tangency portfolio, and express their risk appetite only through how much cash they hold alongside it, or how much they borrow to lever it. A cautious investor holds the tangency portfolio plus cash; an aggressive one holds it with leverage. The line traced by those combinations is called the capital market line.

With the illustrative inputs, the tangency portfolio is almost exactly 50/50, with a Sharpe of 0.330, marginally better than 60/40 at 0.328. That small gap is typical: Sharpe ratios are flat near the optimum, so a range of portfolios are nearly as good as the best one. The flatness is good news for an allocator, because it means a robust, sensible portfolio gives up little relative to a fragile optimal one.

Tangency weight, two assets
w1(tan) = [x1 x s2^2 - x2 x cov] / [x1 x s2^2 + x2 x s1^2 - (x1 + x2) x cov]
x1, x2
Expected excess returns of the two assets over the risk free rate
cov
Covariance between the two assets, rho x s1 x s2
In matrix form: w is proportional to inverse(Sigma) x (mu - rf), scaled so the weights sum to 1.
Worked example

Tangency portfolio for the equity and bond pair

  • Excess returns: equities 8% - 3% = 5%, bonds 4% - 3% = 1%. Variances 0.0256 and 0.0036, covariance 0.00192.
  1. 1. Numerator
    0.05 x 0.0036 - 0.01 x 0.00192 = 0.00018 - 0.0000192 = 0.0001608
    0.0001608
  2. 2. Denominator
    0.05 x 0.0036 + 0.01 x 0.0256 - 0.06 x 0.00192 = 0.00018 + 0.000256 - 0.0001152 = 0.0003208
    0.0003208
  3. 3. Equity weight
    0.0001608 / 0.0003208 = 0.5012
    50.12%
  4. 4. Expected return
    0.5012 x 8% + 0.4988 x 4% = 6.00%
    6.00%
  5. 5. Volatility
    two asset formula with these weights
    9.10%
  6. 6. Sharpe ratio
    (6.00 - 3.00) / 9.10 = 0.330
    0.330

On these inputs the highest Sharpe portfolio is about 50 percent equities. An investor wanting 10.35 percent volatility, the same as 60/40, would hold the tangency portfolio with a little leverage rather than tilt toward equities.

Constraints and risk parity

Real portfolios are never solved unconstrained. Typical constraints include no short selling (weights of zero or more), maximum and minimum weights per asset or sector, limits on leverage, turnover and tracking error against a policy benchmark, and liquidity limits for private assets. Constraints cost a little in theoretical efficiency and buy a great deal in robustness, because they stop the optimiser from acting on its most extreme, and usually least reliable, conclusions.

Risk parity takes a different route. Instead of optimising on expected returns, it sets weights so that each asset contributes equally to total portfolio risk. An asset's risk contribution is its weight times its marginal contribution to volatility; the contributions sum to the portfolio's total variance. For two assets, equal risk contribution reduces to a simple rule regardless of correlation: weight each asset in inverse proportion to its volatility.

The contrast with 60/40 is striking. In a 60/40 portfolio with these inputs, equities supply about 90 percent of the risk, so the portfolio is far less balanced than its capital weights suggest. Risk parity holds about 27 percent equities and 73 percent bonds, with risk split evenly. Its lower volatility is then typically brought up to a target with leverage. Whether that beats 60/40 depends on the bond Sharpe ratio: risk parity wins when the low risk asset offers a higher Sharpe than assumed here, which is the empirical claim its advocates make, and loses when it does not.

Risk contribution and two asset risk parity
RC1 = w1 x (w1 x s1^2 + w2 x cov) / var(Rp) two asset risk parity: w1 = (1/s1) / (1/s1 + 1/s2)
RC1
Share of portfolio variance contributed by asset 1; RC1 + RC2 = 1
1/s
Inverse volatility
With more than two assets, equal risk contribution depends on correlations and is solved numerically. Inverse volatility weighting is then only an approximation.
Worked example

Risk contributions in 60/40 and in risk parity

  • Same illustrative inputs. 60/40 variance 0.0107136 from the first example.
  1. 1. 60/40 equity contribution
    0.6 x (0.6 x 0.0256 + 0.4 x 0.00192) = 0.6 x 0.016128 = 0.0096768
    0.0096768
  2. 2. 60/40 equity share of risk
    0.0096768 / 0.0107136 = 0.903
    90.3%
  3. 3. Risk parity equity weight
    (1/0.16) / (1/0.16 + 1/0.06) = 6.25 / 22.917 = 0.2727
    27.27%
  4. 4. Risk parity bond weight
    1 - 0.2727 = 0.7273
    72.73%
  5. 5. Risk parity return and volatility
    0.2727 x 8% + 0.7273 x 4% = 5.09%; volatility 6.76%
    Sharpe 0.309
  6. 6. Leverage to 60/40 volatility
    10.35 / 6.76 = 1.53x; return 3% + 1.53 x (5.09% - 3%) = 6.20%
    6.20%
    Assumes borrowing at the 3 percent risk free rate.

Equities carry 90 percent of the risk in 60/40. Risk parity balances the risk 50/50, but on these inputs, where bonds have a lower Sharpe ratio than equities, levered risk parity returns 6.20 percent against 6.40 percent for 60/40 at the same volatility.

Estimation error: the optimiser maximises mistakes

Mean variance optimisation treats its inputs as known. They are not. Expected returns in particular are estimated with enormous error: with 16 percent annual volatility, even 20 years of data pin down an asset's mean return only to within about plus or minus 7 percentage points at 95 percent confidence. Volatilities and correlations are estimated much more precisely, which is one reason the minimum variance portfolio is more stable than the tangency one.

The optimiser is extremely sensitive to the inputs it trusts least. The table below changes one expected return at a time by half to one percentage point, well inside any reasonable uncertainty, and the tangency weight in equities swings between 34 and 84 percent. In larger problems with many correlated assets the effect is worse: the optimiser piles into whatever assets happen to have overestimated returns and underestimated risks, a tendency often described as 'error maximisation'.

Practitioners respond in several ways. They impose constraints and weight limits. They shrink sample estimates toward a structured target, for example the Ledoit and Wolf shrinkage of the covariance matrix. They replace historical means with equilibrium returns implied by market capitalisation weights and blend in their own views, which is the Black and Litterman approach. Or they avoid expected returns altogether with minimum variance or risk parity. All of these trade a little theoretical optimality for a great deal of stability.

Tangency equity weight when one expected return changes (rf = 3%, other inputs unchanged)
ChangeEquity returnBond returnTangency equity weight
Base case8.0%4.0%50.1%
Equities 1 point lower7.0%4.0%41.1%
Equities 1 point higher9.0%4.0%58.3%
Bonds half a point lower8.0%3.5%84.2%
Bonds half a point higher8.0%4.5%34.4%
A half point change in the bond return moves the optimal equity weight by 16 to 34 points, because the bond excess return over cash is small and a half point is a large share of it.
Minimum variance and tangency weights in matrix form with numpyPython
import numpy as np

# Illustrative assumptions: equities, bonds
mu = np.array([0.08, 0.04])
vol = np.array([0.16, 0.06])
rho = 0.2
rf = 0.03

corr = np.array([[1, rho], [rho, 1]])
cov = np.outer(vol, vol) * corr
inv = np.linalg.inv(cov)
ones = np.ones(len(mu))

w_mv = inv @ ones / (ones @ inv @ ones)
w_tan = inv @ (mu - rf) / (ones @ inv @ (mu - rf))

print("min variance", np.round(w_mv, 4))
print("tangency    ", np.round(w_tan, 4))
Output
min variance [0.0662 0.9338]
tangency     [0.5012 0.4988]
The same few lines work for any number of assets: replace mu, vol and the correlation matrix.

Templates for this lesson

Included with a Premieur membership.

  • ExcelPortfolio optimiser and VaRFour asset mean variance with risk contributions and component VaR, minimum variance and tangency portfolios with weight and correlation grids, and parametric and historical VaR.Download
  • NotebookVaR and expected shortfall notebookParametric, historical and Monte Carlo VaR and ES for a three asset portfolio, ten day scaling and a Kupiec backtest.Download
Go deeper with Membership →