Yesterday we shared a link to a video showing how Python’s Networkx package could be combined with Gephi to produce some stunning network visualizations. Today we wanted to use these same tools to look at the correlation structure of the S&P 500.
To do so, we took the correlation matrix of the changes in the components of the S&P 500 and linked two stocks with an edge if their absolute correlation was greater than a threshold value (about 0.6). Then we exported the graph in GEXF format so we could use Gephi’s layout and formatting algorithms to create the graph you see highlighted in this post.
The graph forms several distinct clusters, with the largest two merging into a mass of a few hundred stocks centered around Ameriprise Financial (AMP) and Honeywell (HON). The green cluster is comprised of financial services as well as some technology companies, while the blue cluster is formed around multinational manufacturers.
Remember, these stocks are clustered based off their shared correlation structure, so it is revealing that many industry groups are preserved in the graph structure despite using no explicit industry classification in the construction of the graph.
Oil and gas exploration companies make up the pink/red cluster, centered around stocks such as Schlumberger (SLB) and Marathon Oil (MRO). Stocks like Flowserve (FLS) and Dow Chemical (DOW) serve as a bridge between the blue manufacturing cluster and red cluster representing the Oil & Gas industry.
Utility companies make up another distinct cluster in purple, coalescing around stocks like NextEra (NEE) which owns Florida Power and Light.
Some researchers have suggested that using correlation filtered graphs can help investors select robustly diversified portfolios. The theory is that stocks along the periphery represent the least connected stocks from a correlation perspective and thus contain the stocks that are more diversified from the rest of the market.
We use these graphs to identify the ones that are most connected to the market as a whole. These are stocks which are worth watching because they exert a large influence on the market. Much like social networks, where a few accounts are connected to a loosely coupled mass, the stock market contains stocks that act as leaders for the rest of the market. Network graphs can show how investors and traders reduce the complexity of trading a large universe like the S&P 500 by partitioning components into distinct clusters and groups. No stock is an island. Each stock forms part of a fabric of correlation, and financial network graphs can help make sense of an increasingly complex
To check out the fun for yourself, 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.