Friday, January 20, 2017

Correlation between prices or returns?


If you are interested in determining whether there is a correlation between the Federal Reserve Balance Sheet and PPI, would you calculate the correlation between values (prices) or period-to-period change (returns)?


I've massaged both data sets to be of equal length and same date range and have labeled them WWW (WRESCRT) and PPP (PPIACO). Passing them into R we get the following:


> cor(WWW, PPP)
[1] 0.7879144

Then applying the Delt() function:



> PPP.d <- Delt(PPP)

Then applying the na.locf() function:


PPP.D <- na.locf(PPP.d, na.rm=TRUE)

Then passing it through cor() again:


> cor(WWW.D, PPP.D)
[1] -0.406858

So, bottom line is that it matters.



NOTE: To view how I created the data view http://snipt.org/wmkpo. Warning: it needs refactoring but good news is that it's only 27 iines.




No comments:

Post a Comment

technique - How credible is wikipedia?

I understand that this question relates more to wikipedia than it does writing but... If I was going to use wikipedia for a source for a res...