One of my favourite non-trading-related blogs is FlowingData, a visualization and statistics site by Nathan Yau.
I find Data visualization fascinating and inspiring. A good visualization usually “brings data to life” making it easier to understand. Most visualizations featured on FlowingData are very aesthetically pleasing, making the subject a sort of enjoyable and useful “geeky art”. The Correlations Heatmap video below is an attempt at some of this.
Trend Following Wizard Correlations Visualization: Video of Evolution through time
For this post, I got inspired by a reader comment mentioning that it would be interesting to calculate correlations between the Trend Following Wizards reported on the blog.
I agreed with the idea, and seeing this tutorial post on creating heatmaps in R on FlowingData (with sample code: thanks!) gave me the idea of a data visualization of my own: showing the evolution of correlations through a “time-lapse” video of monthly correlation heatmaps through time. Fun and quick little project dealing with trading-related data, visualization and programming. Perfect combination!
The resulting movie is embedded below (available directly on the vimeo website in slightly larger size):
With the color key:
Every month, a rolling 12-month correlation number is calculated (using Pearson) between each Wizard, The full matrix of pairwise correlations is then represented in a heatmap format, with the cell color, directly representing the correlation coefficient, as per the color key above.
The movie simply stitches all heatmaps in chronological order, month after month, from January 1990.
You’ll notice that some cells are grey: light grey means that I do not have any available data for that month for the corresponding Wizard. Dark grey is to hide the correlation between a Wizard and itself (irrelevant as obviously always equal to 1).
It is interesting to see how the heatmap moves from periods of strong correlation (near all-blue, check the Summer of 2003 for example) to more heterogeneous periods.
I was also intrigued by some periods showing real jumps for the whole heatmap (check July 99 to August 99). It is not so surprising though, when you know how data outliers can have a strong influence on the (Pearson) correlation numbers (this is what happens in the jump from July to August in 1999: August 1998 showed strong returns for most Wizards; when these numbers drop off the correlation calculation, the correlation coefficients sharply decrease as a result).
Software note: The movie was created using R to generate the heatmaps (as per FlowingData heatmap tutorial) and XnView + FFmpeg to edit and stitch images into a video.
More Data Visualizations
FlowingData publishes very regularly and the quality is usually very good (Nathan Yau’s book is definitely on my Wish List).
For readers interested in checking it out (watch out, you can quickly spend an hour on the site!), here are some posts or links that caught my attention:
In investing, timing is everything (we know that!): This one is directly related to investing/trading, and I believe Trend Following Wizard CTAs could use the idea to present their past results to prospective investors in a similar fashion. This is a grid diagram which shows annualized returns for the S.& P. 500 for every starting year and every ending year since 1920 – nearly 4,000 combinations in all:
Originally from the NY Times, link to full original diagram
CTAs could plot their monthly returns to get an overall view of what an investor could have made at different periods and highlight specific stats like 36-month, 60-month rolling returns. Possibly another similar chart with drawdowns to complete the picture. This could be an interesting project.
For sport stats lovers:
- Pennant iPad app: Every team. Every game. Every play. 1952 to 2010. If I had an iPad and were into baseball, I’d definitely get this one: it looks really cool. Check the video out.
- Juice Analytics display NFL statistics visually, more interesting than the usual tables.
Our changing world in cartograms:
Series of videos showing the evolution of several indicators per country, morphing the size of countries proportionally to its indicator value. Some surprising world map redrawing!
And finally, an interesting one hour documentary video on “The Joy of Stats” by Hans Rosling