Correlation Graph

Earlier this week, I saw a message in my Twitter feed talking about an unusual correlation pattern between the S&P 500 and the Dow. Unfortunately, the graph produced by the Greg Mankiw recommended site AssetCorrelation.com was grossly inaccurate showing periods of zero correlation between the indices. A few lines of code using the Quantmod package in R can easily replicate the functionality of the site and a prudent analyst can simply load a more reliable data source before arriving at any conclusions. This script takes data from Yahoo finance but you can easily use Google finance or load your own data.

Unknown's avatar

Author: Probable Pattern

Former Marine and Curious Critter

Leave a comment