From aim at stats.uwo.ca  Tue Nov 28 17:50:20 2006
From: aim at stats.uwo.ca (A.I. McLeod)
Date: Tue, 28 Nov 2006 11:50:20 -0500
Subject: [Rd] ccf documentation bug or suggeston
Message-ID: <000e01c7130d$4d4f3e50$884c6481@stats2.uwo.ca>

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



[Rd] ccf documentation bug or suggeston
A.I. McLeod