From: A.I. McLeod <aim_at_stats.uwo.ca>

Date: Tue 28 Nov 2006 - 16:50:20 GMT

R-devel@r-project.org mailing list

https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed Nov 29 03:56:09 2006

Date: Tue 28 Nov 2006 - 16:50:20 GMT

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 Received on Wed Nov 29 03:56:09 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Tue 28 Nov 2006 - 17:30:51 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel.
Please read the posting
guide before posting to the list.
*