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:
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.

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 
another.

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:

VALUE:
a list with the following components:
acf
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.
lag
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

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to