On Fri, Oct 12, 2012 at 12:28 AM, Mihnea Constantinescu
<mihnea.co...@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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to