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

aim at stats.uwo.ca aim at stats.uwo.ca
Tue Nov 28 17:50:44 CET 2006

Hi Duncan,

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:
However S-Plus acf uses the d(k) definition in their acf function.

For interpretive purposes this is a **vital distinction** (the cross-covariance/correlation is not symmetric like the 
autocovariance/autocorrelation).  There is not fixed convention is textbooks or research papers.  Some define it one way and other 

There is no ccf function in S-Plus. Instead there is only acf for the auto/cross computation in multivariate time series.  This is 
more complicated since numerical output is 3D array.

Here is how S-Plus documents it:

a list with the following components:
a three-dimensional array containing the autocovariance or autocorrelation function estimates. acf[i,j,k] is the covariance (or 
correlation) between the j -th series at time t and the k-th series at time t+1-i.
an array the same shape as acf containing the lags (as fractions of the sampling period) at which acf is calculated. If j > k and i 
 > 1, then lag[i,j,k] is negative.

Ian McLeod

More information about the R-devel mailing list