The dear mark leeds <markleeds@verizon.net>
Has pointed me that the answer to my question was in the MASS book, in page
390
Where it is said that acf works by dividing the covariance with N instead of
N-t
so to insure that the covariance sequence is positive definite.
Although I am not sure if to my purposes it means I should use the one over
the other.
Thanks again to Mark,
Tal
----------------Contact
Details:-------------------------------------------------------
Contact me: Tal.Galili@gmail.com | 972-52-7275845
Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
www.r-statistics.com (English)
----------------------------------------------------------------------------------------------
On Mon, Apr 26, 2010 at 8:49 PM, Tal Galili <tal.galili@gmail.com> wrote:
> Hi all,
>
> I am getting different results from ccf and cor,
> Here is a simple example:
>
> set.seed(100)
> N <- 100
> x1 <- sample(N)
> x2 <- x1 + rnorm(N,0,5)
> ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
> cor(x1[-N], x2[-1])
>
>
> Results:
>
> > ccf(x1,x2)$acf[ccf(x1,x2)$lag == -1]
> [1] -0.128027
> > cor(x1[-N], x2[-1])
> [1] -0.1301427
>
>
> Thanks,
> Tal
>
>
>
>
> ----------------Contact
> Details:-------------------------------------------------------
> Contact me: Tal.Galili@gmail.com | 972-52-7275845
> Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
> www.r-statistics.com (English)
>
>
----------------------------------------------------------------------------------------------
>
>
>
[[alternative HTML version deleted]]