(This article was first published on

**Joe's Data Diner**, and kindly contributed to R-bloggers)“The law itself follows Gold” *Sextus Propertius*.

But what about stocks, bonds and real estate? Do they follow Gold too? Using the correlation data from my previous post, The Financial Crisis on Tape Part I, this question is easy to investigate. Indeed, it’s possible to see the correlations in last week’s graph:

where GLD is a Gold tracking fund. Fortunately, the excellent ggplot2 package means that in two slightly chunky lines we can create a bespoke heat-map to answer this question and we don’t have to strain our eyes finding them in the graph above!

SPY: S&P 500

QQQ: Nasdaq 100

EEM: Emerging Markets

IWM: Russel 2000

EFA: EAFE (Europe, Australasia and Far East)

TLT: 20 Year Treasury

IYR: U.S. Real Estate

Here are the two lines used to create it (using data obtained in The Financial Crisis on Tape Part I):

In quieter times it seems that Gold is reasonably un-correlated to the other sectors, but in times of stress, strong correlations appear as expected. The really interesting point is the strong negative correlation seen in Q3 2008. Let’s take a look at the price time series of the S&P, Nasdaq and Gold during ’07-’08:

In terms of the units, these are the prices of representative funds not the assets themselves (see the links to Yahoo Finance which I’ve provided above). As the prices are similar and fit nicely I’ve not used any scaling. The negative correlation is probably related to Gold’s safe haven status. As stocks started dropping, a strong bid for Gold supported its price. This can result in a negative correlation. The graph was created using the code below.

To

**leave a comment**for the author, please follow the link and comment on their blog:**Joe's Data Diner**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...