Why Autocorrelation Doesn't Correlate to Correlation (in R)

0 comments
I hate getting a result I don't expect, but I like to cross-check every calculation I do, especially when I am relying on the calculation procedures contained in an R package. This is a recipe for "agita".

I was recently exploring R's autocorrelation function: acf(x, lag.max). I was applying it to the returns series for the last 5 years of Winton's diversified fund - try it you might find it interesting. I cross-checked the results using R's correlation function: cor(x, y). y was set to a lagged version of x i.e. y(t) = x(t - lag). I could not seem to get the results to match; they were close but not exactly the same.

The R documentation cites "Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth Edition. Springer-Verlag." as the source for the code, but I don't have it. So I had to do some sleuthing...
Get widget