Earlier we posted a correlation heatmap of the S&P 500. An alternative way to visualize the clustered structure of the financial markets is to use Minimum Spanning Trees (MST). The figure below is a MST for components of the S&P 500. Oftentimes this presents a much clearer picture of the clusters (click to enlarge and explore, image is 5k x 5k pixels):
Like correlation heatmaps, MSTs can be generated from a correlation matrix. The basic algorithm for constructing a MST is:
- Sort all pair-wise correlations in the matrix by magnitude
- Start with the pair that has the highest magnitude correlation, this is your first link
- Select the next highest magnitude correlation if and only if that doesn’t create a loop in the graph
- Repeat until every instrument has a vertex on the graph
The above graph was created with the minimum.spanning.tree(…) function in igraph.
Want to explore Minimum Spanning Trees for yourself? Then visit our SliceMatrix signup page. Explore Minimum Spanning Trees and Filtered Correlation Networks for the S&P 400, S&P 500, S&P 600 and NASDAQ 100 indexes.