Being a loser is an art.

I am not interested in being a good loser, but in knowing when to quit.

The art of quitting can be acquired after a little numerical analysis.

(Not necessarily due to all the confusing linear algebra!)

In the world of numerical solutions there is no correct answer. Knowing when your search for an answer is 'good enough' or when to quit is extremely important.

Everyone's a loser loitering about in this uncomfortable mathematical neighbourhood.

Now, you can be a loser too!


I just added numeric.js to the Lazy Backtesting IDE.

You can now create strategies which optimise, and calculate PCA etc. to your heart's content.

As an introduction, I wrote a few lines of code to replicate Meucci's research in his 'Managing Diversification' paper.

Following my 'War of Ideas' post; we mathematically pick out the main drivers of the returns (or 'ideas') in your portfolio and try to balance them out.

The assumption is that volatility and correlation is a little stickier and easier to forecast than returns - so instead of maximising returns we aim to efficiently utilise our portfolio's risk. Leading to better risk adjusted performance.

I use numeric.js' uncmin() solver to balance the contribution of each idea.

Numeric also provides a handy svd function with which I break out each idea into a 'separable model' to find the percentage of returns explained by each idea.

The Strategy

I backtest a portfolio with three layers of risky assets.

Firstly the S&P 500 (SPY); secondly +20 year treasury bonds (TLT) and finally gold (GLD).

In a way, I am giving the strategy clearly defined fallbacks.

Also the assets belong to pretty distinct asset classes - giving the algorithm more ability to balance out the 'ideas'.

The 'War of Ideas' strategy has a Sharpe of over 0.8 over 10 years, which converts into about a 1.35% chance of trading noise. Not amazing.

Here's how it allocates the assets over time.

The strategy is better than the equal allocation (or 1/n) which results in a Sharpe of about 0.7 - or a 2.4% chance of accruing a loss over 10 years. Almost half the chance of being profitable!

Numeric's solvers can't come up with super balanced 'ideas' all the time however.

Sometimes it achieved 99% diversification (e.g. each idea contributes the same proportion of returns) but when markets are highly correlated it struggles. The least successful optimisation is 23% diversification during the Autumn of '08.

Managing Failure

The fundamental raison d'etre of this strategy is about recognising that we are all losers.

In a world where we cannot predict returns from one day to the next this is sensible, we fallback to efficiently utilising sticky correlation and volatility.

Similarly, numerical analysis is about managing mathematical failure.

If only we had similar tools to manage our daily lives.

Oh right! We have Ben and Jerry's as a fallback!