Portfolio Optimization
Portfolio optimisation uses maths to choose weights that best meet a goal. Learn mean variance, minimum variance, constraints and how to handle estimation error.
Portfolio optimisation is the use of mathematics to choose portfolio weights that best achieve a stated goal, such as the highest expected return for a given risk, the lowest possible volatility or the best risk adjusted return. Optimisers can weigh dozens or thousands of assets, correlations and constraints at once, something no human can do by intuition. Yet their outputs are only as good as their inputs, and with noisy financial data, a naive optimiser can produce portfolios that are concentrated, unstable and worse than simple alternatives.
Common objectives#
| Objective | Inputs needed | Character |
|---|---|---|
| Mean variance (target return or risk) | Expected returns, covariances | Classic Markowitz. See Modern Portfolio Theory and the Efficient Frontier |
| Maximum Sharpe ratio | Expected returns, covariances | Tangency portfolio. See Sharpe Ratio |
| Minimum variance | Covariances only | No return forecasts; favours low volatility, low correlation assets |
| Risk parity | Covariances only | Equal risk contributions. See Risk Budgeting and Risk Parity |
| Maximum diversification | Volatilities, covariances | Maximises the ratio of weighted volatilities to portfolio volatility |
| Minimum CVaR | Return scenarios | Targets tail losses. See Expected Shortfall (CVaR) |
The estimation error problem#
Expected returns are extremely hard to estimate. With 16% annual volatility, even 20 years of data leaves a standard error of about 3.6 percentage points on a stock market's average return (16% divided by the square root of 20). Optimisers treat inputs as exact and pile into assets whose returns happen to be overestimated.
Making optimisation robust#
| Technique | Idea |
|---|---|
| Constraints | Weight caps, no shorting, sector limits, turnover limits |
| Shrinkage | Pull estimates toward a simple target, such as equal correlations (Ledoit Wolf for covariances) |
| Black Litterman | Start from market implied returns. See Black-Litterman Model |
| Resampling | Average optimal weights over many simulated input sets |
| Robust optimisation | Optimise for the worst case within a range of inputs |
| Risk based objectives | Avoid return forecasts entirely |
| Hierarchical risk parity | Cluster assets by correlation and allocate through the tree, proposed by Marcos López de Prado |
Including costs#
Real optimisers include transaction costs and turnover penalties, so they only trade when the expected improvement exceeds the cost. Without this, rebalancing a frequently optimised portfolio can consume much of its expected advantage. See Transaction Costs and Rebalancing.
A simple, robust baseline#
Studies such as DeMiguel, Garlappi and Uppal (2009) found that many optimised portfolios failed to beat a simple 1 divided by N equal weight portfolio out of sample, once estimation error was accounted for. Any optimisation method should be compared against equal weighting and inverse volatility weighting. See Equal, Value and Volatility Weighting.
Tools#
Python libraries such as PyPortfolioOpt, Riskfolio Lib and cvxpy make optimisation accessible. Their convenience makes it all the more important to understand the assumptions. See Python for Trading.
Frequently asked questions#
What is portfolio optimisation?#
Choosing portfolio weights mathematically to best meet a goal, such as maximising risk adjusted return or minimising volatility, subject to constraints.
Why do optimised portfolios often disappoint?#
Inputs, especially expected returns, are highly uncertain, and optimisers concentrate in assets with overestimated returns, producing unstable portfolios.
Is minimum variance better than mean variance?#
It avoids return forecasts, so it is often more stable out of sample, but it can concentrate in low volatility assets and sectors.
Next, learn how to see which positions drive risk in Risk Contribution and Risk Decomposition.
3 quick questions on this lesson. Get them all right to finish it.
Turn on JavaScript to take the quiz.
Mentioned in
- Portfolio ConstructionPortfolio and Performance
- Equal, Value and Volatility WeightingPortfolio and Performance
- RebalancingPortfolio and Performance
- Expected Shortfall (CVaR)Portfolio and Performance
- Bayesian StatisticsMath and Statistics
- Linear Algebra for TradersMath and Statistics