An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121011/ee57231c/attachment.pl>
ccf(x,y) vs. cor() of x and lagged values of y
2 messages · Mihnea Constantinescu, R. Michael Weylandt
1 day later
On Fri, Oct 12, 2012 at 12:28 AM, Mihnea Constantinescu
<mihnea.const at gmail.com> wrote:
Hi I'm computing the correlation between two time-series x_t and y_t-1 (time-series lagged using the lag(y,-1) function) using the cor() function and the returned value is different from the value of ccf() function at the same lag. Any ideas why this is so?
I'd bet that you'd also find that cor(x,y) = cor(x, lag(y,-1)) ? That's because the effect of "lagging" seems to be discarded by cor() which only looks at the data itself and doesn't align the observations. The ccf() result is the one you want. Cheers, Michael