Wednesday, June 11, 2014

"The Equation that Will Change Finance"

In yesterday's "Climateer Quote of the Day: Volatility Edition (VIX)" I mentioned how FT Alphaville's Izabella Kaminska had gotten me thinking about shorting gold with a piece she had written just five days before the Dec. 2012 intermediate-term high of $1715 (down from 2011's $1923.70 but far above today's $1263.70).

In "Capping the gold price" she basically took out the upside for shiny so my thought process upon reading it was pretty much "Duh, semi-variance" followed by a pull off the iced tea and other distractions.
A few weeks later someone's random comment on gold triggered a "Hey, wait a minute" moment.

Here's why the above meanderings might be of interest to you. From Sigma1 Financial June 2012:

The Equation that Will Change Finance 
Two mathematical equations have transformed the world of modern finance.  The first was CAPM, the second Black-Sholes.  CAPM gave a new perspective on portfolio construction.  Black-Sholes gave insight into pricing options and other derivatives.  There have me many other advancements in the field of financial optimization — such as Fama-French — but CAPM and Black-Sholes stand out as the two most influential.

Enter Semi-Variance
Modified Semi-Variance Equation
Modified Semi-Variance Equation, A Financial Game Changer

When CAPM (and MPT) were invented, computers existed, but were very limited.  Though the father of CAPM, Harry Markowitz, wanted to use semi-variance, the computers of 1959 were simply inadequate.  So Markowitz used variance in his ground breaking book “Portfolio Selection — Efficient Diversification of Investments”.

Choosing variance over semi-variance made the computations orders of magnitude easier, but the were still very taxing to the computers of 1959.  Classic covariance-based optimizations are still reasonably compute-intensive when a large number of assets are considered.  Classic optimization of 2000 asset portfolio starts by creating a 2,000,000 entry covariance matrix, and that is the easy part.  The hard part involves optimizing (minimizing) portfolio variance for a range of expected returns.  This is often referred to as computing the efficient frontier.

The concept of semi-variance (SV) is very similar to variance used in CAPM.  The difference is in the computation.  A quick internet search reveals very little data about computing a “semi-covarience matrix”.  And would such a matrix allow quick and precise computation of portfolio semi-variance in the same way that a covariance matrix does for computing portfolio variance?  I suspect not.  If anyone know otherwise, please leave a comment below.

The beauty of SV is that it measures “downside risk”, exclusively.  Variance includes the odd concept of “upside risk” and penalizes investments for it.  While not  going to the extreme of rewarding upside “risk”, the modified semi-variance formula presented in this blog post simply disregards it.
I’m sure most of the readers of this blog understand this formula.  Please indulge me while a touch on some of the finer points.   First, the 2 may look a bit out of place.  The 2 simply normalizes the value of SV relative to variance (V).  Second, the “question mark, colon” notation simply means if the first statement is true use the squared value in summation, else use zero.  Third, ri is ΔRi, or Ri – R(i-1).  Fourth, notice I use ri rather than ri – ravg.

The last point above is intentional and another difference from “mean variance”, or rather “mean semi-variance”.  If R is monotonically increasing during for all samples (n intervals, n+1 data points), then SV is zero.  I have many reasons for this choice.  The primary reason is that with  ravg the SV for a straight descending R would be zero.  I don’t want a formula that rewards such a performance with 0, the best possible SV score.  [Others would substitute T, a usually positive number, as target return, sometimes called minimal acceptable return.]

Finally, a word about R.  For this discussion R is 1.0 at time zero (i=0) and Ri is the total return relative to R0.  For more on total return, please refer to my previous post.  Thus ri is the total return over the interval i.  Intervals should be as uniform as possible.  I tend to avoid daily intervals due to the non-uniformity introduced by weekends and holidays.  Weekly (last closing price of the trading week), monthly (last closing price of the month), and quarterly are significantly more uniform in duration.

Big Data and Heuristic Algorithms
Innovations in computing and algorithms are how semi-variance equations will change the world of finance.  Common sense is why. I’ll explain why heuristic algorithms like Sigma1′s HALO can quickly find near-optimal SV solutions on a common desktop workstation, and even better solutions when leveraging a data center’s resources.  And I’ll explain why SV is vastly superior to variance.

Computing SV for a single portfolio of 100 securities is easy on a modern desktop computer.  For example 3-year monthly semi-variance requires 3700 multiply-accumulate operations to compute portfolio return, Rp, followed by a mere 37 subtractions, 36 multiplies (for squaring), and 36 additions (plus multiplying by 2/n).  Any modern computer can perform this computation in the blink of an eye.

Now consider building a 100-security portfolio from scratch.  Assume the portfolio is long-only and that any of these securities can have a weight between 0.1% and 90% in steps of 0.1%.  Each security has 900 possible weightings.  I’ll spare you the math — there are 6.385*10138 permutations. Needless to say, this problem cannot be solved by brute force.  Further note that if the portfolio is turned into a long-short portfolio, where negative values down to -50% are allowed, the search space explodes to close to 102000.
I don’t care how big your data center is, a brute force solution is never going to work.  This is where heuristic algorithms come into play.  Heuristic algorithms are a subset of metaheuristics.  In essence heuristic algorithms are algorithms that guide heuristics (or vise versa) to find approximate solution(s) to a complex problem.   I prefer the term heuristic algorithm to describe HALO, because in some cases it is hard to say whether a particular line of code is “algorithmic” or “heuristic”, because sometimes the answer is both.  For example, semi-variance is computed by an algorithm but is fundamentally a heuristic....MORE
Pt. II: Mar. 2, 2014
Semi-variance: Choosing the Best Formula