# Portfolio Optimization Algorithm Showdown: GTAA Edition

I was revisiting the choice of portfolio optimization algorithm for the GTAA portion of my portfolio and thought it was an excellent opportunity for another post. The portfolio usually contains 5 assets (though at times it may choose fewer than 5) picked from a universe of 17 ETFs and mutual funds, which are picked by relative and absolute momentum. The specifics are irrelevant to this post as we’ll be looking exclusively at portfolio optimization techniques applied after the asset selection choices have been made.

Tactical asset allocation portfolios present different challenges from optimizing portfolios of stocks, or permanently diversified portfolios, because the mix of asset classes is extremely important and can vary significantly through time. Especially when using methods that weigh directly on volatility, bonds tend to have very large weights. During the last couple of decades this has been working great due to steadily dropping yields, but it may turn out to be dangerous going forward. I aim to test a wide array of approaches, from the crude equal weights, to the trendy risk parity, and the very fresh minimum correlation algorithm. Standard mean-variance optimization is out of the question because of its many and well-known problems, but mainly because forecasting returns is an exercise in futility.

## The algorithms

The only restriction on the weights is no shorting; there are no minimum or maximum values.

• Equal Weights

Self-explanatory.

• Risk Parity (RP)

Risk parity (often confused with equal risk contribution) is essentially weighting proportional to the inverse of volatility (as measured by the 120-day standard deviation of returns, in this case). I will be using an unlevered version of the approach. I must admit I am still somewhat skeptical of the value of the risk parity approach for the bond-related reasons mentioned above.

• Minimum Volatility (MV)

Minimum volatility portfolios take into account the covariance matrix and have weights that minimize the portfolio’s expected volatility. This approach has been quite successful in optimizing equity portfolios, partly because it indirectly exploits the low volatility anomaly. You’ll need a numerical optimization algorithm to solve for the minimum volatility portfolio.

• MV (with shrinkage)

A note on shrinkage (not that kind of shrinkage!): one issue with algorithms that make use of the covariance matrix is estimation error. The number of covariances that must be estimated grows exponentially with the number of assets in the portfolio, and these covariances are naturally not constant through time. The errors in the estimation of these covariances have negative effects further down the road when we calculate the desired weightings.  A partial solution to this problem is to “shrink” the covariance matrix towards a “target matrix”. For more on the topic of shrinkage, as well as a description of the shrinkage approach I use here, see Honey, I Shrunk the Sample Covariance Matrix by Ledoit & Wolf.

• Equal Risk Contribution (ERC)

The ERC approach is sort of an advanced version of risk parity that takes into account the covariance matrix of the assets’ returns (here‘s a quick comparison between the two). This difference results in significant complications when it comes to calculating weights, as you need to use a numerical optimization algorithm to minimize

subject to the standard restrictions on the weights, where xis the weight of the ith asset, and (Σx)i denotes the ith row of the vector resulting from the product of Σ (the covariance matrix) and x (the weight vector). To do this I use MATLAB’s fmincon SQP algorithm.

For more on ERC, a good overview is On the Properties of Equally-Weighted Risk Contributions Portfolios by Maillard, et. al.

• ERC (with shrinkage)

See above.

• Minimum Correlation Algorithm (MCA)

A new optimization algorithm, developed by David Varadi, Michael Kapler, and Corey Rittenhouse. The main object of the MCA approach is to under-weigh assets with high correlations and vice versa, though it’s a bit more complicated than just weighting by the inverse of assets’ average correlation. If you’re interested in the specifics, check out the paper: The Minimum Correlation Algorithm: A Practical Diversification Tool.

## The results

Moving on to the results, it quickly becomes clear that there isn’t much variation between the approaches. Most of the returns and risk management are driven by the asset selection process, leaving little room for the optimization algorithms to improve or screw up the results.

Predictably, the “crude” approaches such as equal weights or the inverse of maximum drawdown don’t do all that well. Not terribly by any means, but going up in complexity does seem to have some advantages. What stands out is that the minimum correlation algorithm outperforms the rest in both risk-adjusted return metrics I like to use.

Risk parity, despite its popularity, wallows in mediocrity in this test; its only redeeming feature being a bit of positive skew which is always nice to have.

The minimum volatility weights are an interesting case. They do what is says on the box: minimize volatility. Returns suffer consequently, but are excellent on a volatility-adjusted basis. On the other hand, the performance in terms of maximum drawdown is terrible. Some interesting features to note: the worst loss for the minimum volatility weights is by far the lowest of the pack: the worst day in over 15 years was -2.91%. This is accompanied by the lowest average time to recover from drawdowns, and an obscene (though also rather unimportant) longest winning streak of 22 days.

Finally, equal risk contribution weights almost match the performance of minimum volatility in terms of CAGR / St.Dev. while also giving us a lower drawdown. ERC also comes quite close to MCA; I would say it is the second-best approach on offer here.

A look at the equity curves below shows just how similar most of the allocations are. The results could very well be due to luck and not a superior algorithm.

To investigate further, I have divided the equity curves into three parts: 1996 – 2001, 2002-2007, and 2008-2012. Consistent results across these sub-periods would increase my confidence that the best algorithms actually provide value and weren’t just lucky.

As expected there is significant variation in results between sub-periods. However, I believe these numbers solidify the value of the minimum correlation approach. If we compare it to its closest rival, ERC, minimum correlation comes out ahead in 2 out of 3 periods in terms of volatility-adjusted returns, and in 3 out of 3 periods in terms of drawdown-adjusted returns.

The main lesson here is that as long as your asset selection process and money/risk management are good, it’s surprisingly tough to seriously screw up the results by using a bad portfolio optimization approach. Nonetheless I was happily surprised to see minimum correlation beat out the other, more traditional, approaches, even though the improvement is marginal.

• ##### qusma says:

Thanks a lot. These tests were done in MATLAB.

• ##### Christian says:

Very nice post! How often do you adjust positions and whats the effect when including transaction costs and slippage. Since some of the algos require more transactions the cost of this might be a drag to the performance

• ##### qusma says:

Thanks Christian. The number of transactions is (almost) completely independent of the portfolio optimization algorithm. What drives trades are the asset allocation choices, and these happen before I get to the stage where I optimize the weights.

I usually adjust positions weekly, unless there are no changes in the asset mix and the weight adjustments are too small to warrant paying commissions.

• ##### Christian says:

Another thing is that all the algos have one or more parameters. How have you chosen the parameters for this test? Are they optimized in any way? Wrong parameters might be a reason for future performance failure.

• ##### qusma says:

If we ignore the shrinkage factor (which has a tiny effect), the only parameter to change is the length of the period of data that I use to calculate volatility, max drawdown, the covariance matrix, etc.

These values have been subject to optimization…I might write a post in the future about it, but in most cases the difference between the best and worst results within a “reasonable” range of values is very small and statistically insignificant. In most cases I simply use 120 days, which is also the period I use to calculate momentum.

• ##### tstudent says:

I’ve done some test with these portfolio algorithms. Minimum variance, risk parity and now minimum correlation…all show better risk/adjusted performance because they weight more the best asset class in the last decades: bonds. In my simulation with 5 asset class (us equity, international equity, Treasury 10 years, REITs and Commodities) MCA algorithm suggest a weight of 73% on 10y Treasury. My question is about the pratical utility of these algorithm for real investment. How is possible today to put 73% in long Treasury?

• ##### qusma says:

You are of course correct that most of these algorithms tend to over-weigh fixed income, which has been extremely beneficial during the last few decades of decreasing interest rates.

If we take them in the context of a permanent portfolio that always allocates to all asset classes, then I would consider the use of risk parity/minimum volatility/MCA quite dangerous going forward. There is little upside (a good post at marketsci over how much upside there’s left in regards to interest rates: http://marketsci.wordpress.com/2012/10/16/follow-up-to-timely-portfolios-what-if-we-go-to-zero/ ) and a LOT of risk if things go badly.

However, in the context of a relative & absolute momentum-based tactical allocation approach, I think there is much less of a problem. If bonds start doing badly, there simply won’t be any capital allocated to them. Thus the issue of their weighting becomes irrelevant. Now it could be the case that these algorithms only do an outstanding job when bonds are included in the portfolio (which can be tested by running the same system but without any of the bond funds). But that would simply lead to somewhat sub-optimal returns and not outright catastrophe.

• ##### qusma says:

You are of course correct that most of these algorithms tend to over-weigh fixed income, which has been extremely beneficial during the last few decades of decreasing interest rates.

If we take them in the context of a permanent portfolio that always allocates to all asset classes, then I would consider the use of risk parity/minimum volatility/MCA quite dangerous going forward. There is little upside (a good post at marketsci over how much upside there’s left in regards to interest rates: http://marketsci.wordpress.com/2012/10/16/follow-up-to-timely-portfolios-what-if-we-go-to-zero/ ) and a LOT of risk if things go badly.

However, in the context of a relative & absolute momentum-based tactical allocation approach, I think there is much less of a problem. If bonds start doing badly, there simply won’t be any capital allocated to them. Thus the issue of their weighting becomes irrelevant. Now it could be the case that these algorithms only do an outstanding job when bonds are included in the portfolio (which can be tested by running the same system but without any of the bond funds). But that would simply lead to somewhat sub-optimal returns and not outright catastrophe.

• ##### tstudent says:

Yes, i think that the difference between permanent and tactical exists and is very important. But at the same time don’t think that this difference makes the question irrelevant.
It’s stupid and unwise put 73% to bond (like algo suggest), even in a contex of tactical strategies. We can have a rapid move on that 73% asset class with the paradoxical consequence that the same algo whose aim is to reduce risk is the principal cause of higher (even catastrophic) risk.
I think that we need to find a better way and incorporate this pratical consideration in the algo.

• ##### qusma says:

You can always institute some minimum/maximum “sanity” limits on the weights, just as you would in standard mean-variance optimization. It would probably hurt performance in the long run, but let you sleep better at night…

• ##### qusma says:

Well, it depends. Personally I don’t use MCA but risk parity, so I don’t get weights THAT extreme.

Fundamentally I would say that it is a question of whether you believe your backtest sample is (at least roughly) representative of what you can expect to see in the future. Perhaps with <20 years of data it's not…in which case it could be a good idea to impose limits on the maximum weights that your optimization algorithm spits out.

Maybe the next Black Monday style event will be in Treasuries…nobody knows of course, but there are certainly good arguments for such limits.

I just ran a quick test with a 33% max weight on the MCA algo. The end results are very similar…the max limit has worse volatility-adjusted performance, but better drawdown-adjusted performance. The differences are quite small though. So my opinion would be to impose maximum weights that you're comfortable with.

• ##### tstudent says:

I agree with you on “<20 years….".

In reading what you wrote i can't not make you a question.

If numbers seems to show the superiority of MC (but also equal risk contribution and minimum variance seems to be better) why your choice is Risk Parity? For Risk Parity you mean weight proportional to inverse of standard deviation, is it correct? What are the reasons for this choice that convinced you to not use the best algo? I agree that numbers are not all and that it's important to think over them. I'm interested to ear your ideas about this not simple matter.

• ##### qusma says:

A very reasonable question. The answer is that MC is very new, and this is the first and still only test I have used it in. I’m just not confident enough in it yet. I plan to run a ton of tests with it, optimizing different sets of assets (I’m particularly interested in how it would handle a portfolio of stocks for example), seeing how it performs during sharp volatility increases, etc. If the results are convincing, I’ll probably switch to MC (or even better, an improved version of it if I can find something to improve on).