[Rd] ccf documentation bug or suggeston (PR#9394)

murdoch at stats.uwo.ca murdoch at stats.uwo.ca
Tue Nov 28 21:39:49 CET 2006


On 11/28/2006 12:50 PM, murdoch at stats.uwo.ca wrote:
> On 11/28/2006 11:50 AM, A.I. McLeod wrote:
>> Hi Duncan,
> 
> Hi Ian.
> 
>> 
>> ccf(x,y) does not explain whether c(k)=cov(x(t),x(t+k)) or d(k)=cov(x(t),x(t-k)) is calculated.  The following example demonstrates 
>> that the c(k) definition is used:
>> ccf(c(-1,1,rep(0,8)),c(1,rep(0,9)))
>> However S-Plus acf uses the d(k) definition in their acf function.
> 
> I don't think our code looks right, let alone our documentation.  In 
> both R-devel and R-patched I get a lag zero value of 1 from ccf(), and I 
> think I should get cor(x,y), which in your example, would be -0.74:  and 
> that is what I get from 2.4.0.
> 
> I hope this isn't a result of my patch to allow length 1 series...

It was.  I'll commit a patch to my patch soon, and clarify the docs at 
the same time.

Duncan Murdoch



More information about the R-devel mailing list