# Mean-Variance Optimization by Markowitz

The Mean-Variance Optimization by Markowitz

In 1952, Harry Markowitz published a paper on portfolio selection and the effects of diversification on security returns. According to his paper, an efficient portfolio is one that combines the different assets to provide the highest level of expected return while undertaking the lowest level of standard deviation (or risk).

The name Mean-Variance Optimization means, in other words, that we try to create portfolios that have the maximum mean (expected return) for a given variance of return (or standard deviation of returns) or the minimum variance of return for a given mean (expected return).

The basic principle of portfolio optimization is that the more risk you take, the higher your reward. Harry Markowitz' theory allows us to adapt the amount of risk we take in the prospect of achieving the returns we expected.

The basic concept is to build a portfolio which consists of a normal assets like equities or bonds and add riskless assets like the short-term treasury bills (government bills). By varying the proportion of each asset, it allows us to vary the amount of risk we wish to undertake vs the returns we hope to achieve.

In our example, we use the S&P 500, 1-3 Year U.S. Treasury Bonds, 7-10 Year U.S. Treasury Bonds, Investment Grade Corporate Bonds and Commodities to construct a portfolio.

Inputs for the Mean-Variance Optimization

In order to start calculating the optimal portfolio, we need these 5 inputs, all of which can be extracted from a simple time series:

Expected return riskless assets: This can be the published rate of a U.S Treasury Bill or an assumed riskless rate.

Standard deviation of riskless assets: This is assumed to be zero as the asset is considered riskless.

Expected return of assets: This can be estimated by using historical prices of the asset or an assumed expected return.

Standard deviation of assets: This can be estimated by calculating the standard deviation of the asset from historical prices and assumed standard deviation.

Correlation between assets: How do our asset classes relate to each other?

Let's look at our five assets and see how much they historically returned (remember, in the pure Markowitz optimization historical returns equal expected returns!) and how much standard deviation they had (risk): For instance, the S&P 500 has had an annualized return of 7.64% since 2006 and a standard deviation of 20.16%. Corporate Bonds have had 5.4% annualized return while 8.48% standard deviation. So on and so forth we get the first inputs for our Mean-Variance Optimization.

Correlation of Assets

One of the basic aspects of building a portfolio is to include assets which are negatively correlated or have a small positive correlation with each other. When the assets in a portfolio do not move in the same
direction, it is thought to be safer as they do not fluctuate as much in sum.

Now, let's look at the correlation matrix of our 5 assets: We see, for instance, that the S&P 500 is negatively correlated with 7-10 Year Treasury Bonds, while positively correlated with Commodities. However, these correlations are rather weak. A stronger (positive) correlation is, for instance, found between 1-3 Year Treasury Bonds (Bills) and 7-10 Year Treasury Bonds, which means they move in tandem.

Output of the Mean-Variance Optimization

The efficient frontier, i.e. the set of optimal portfolios that offer the highest expected return for a defined level of risk or the lowest risk for a given level of expected return is the output of the Mean-Variance Optimization.

With the information we have, there are countless possibilities to combine these assets in many ways possible, and then we could see how the overall portfolio statistics (return and risk, foremost) look like. We could start with one that has 100% S&P 500, and 0% of everything else, and then go down that line, for instance try one that has 98% S&P 500, 1% 1-3 Year Treasury Bills and 1% 7-10 Year Treasury Bills, and so on so forth. However, since we usually do not want to sit and manually calculate all possible combinations, we use a mathematical solver that does the job for us.

If you look at the chart below, we can see how such an optimization works. The red dots show possible combinations of assets (as such each of them is a portfolio with certain asset weights - there are many more combinations possible than just these exemplary dots). The purple line (both the dotted and the consistent one) shows the limits of all combinations. Above and to the left of this line, there are no portfolios possible with the assets we have chosen. Below and to the right is the area where we can find all possible combinations.

The most important thing in this graphical example are the consistent and the dotted line. Both the dotted line and all portfolios below and to the left of both the dotted and consistent line show portfolio combinations that are inefficient. These portfolios have risk/return trade-offs that are unfavorable. This is where the consistent line comes into play: It shows us all efficient portfolios where we have maximum return for the least level of standard deviation.

Once we have this optimization, we can choose where to position ourselves in this consistent line. In the graphic below, we have indicated a so-called minimum variance portfolio, which is the portfolio that has the lowest possible standard deviation of all possible efficient asset combinations, but of course you can also choose any combination along this line depending on the expected risk you want to take. Let's see how something like this looks in a real-life optimization with the 5 assets we have chosen (note that I have added the constraints that no asset should have less than 5% and no more than 30%): We can see here all our 5 asset classes, as well as the efficient frontier of Mean-Variance efficient portfolios. In this case, there is no consistent line, but rather actual portfolios indicated as circles to show the efficient frontier.

Let us have a look at the first 10 portfolio combinations sorted by standard deviation, alongside the weights of each asset: Result number 1 would be our minimum variance portfolio. That is the portfolio that has, regardless of return, the lowest standard deviation. The third portfolio is our tangency portfolio, i.e. the portfolio with the highest Sharpe ratio or in other words the one with the best risk/reward trade-off.

If we look at it from the other side, we can see the efficient portfolios with the highest return: 