Rick
Posts:
11
Registered:
3/5/10


Re: difference between xcorr and crosscorr?
Posted:
Oct 18, 2012 11:55 AM


Iris,
The distinction between the 2 functions is likely due to the intended audience.
The CROSSCORR in the Econometrics Toolbox is designed for financial/economic users, wherein the standard approach is to remove the mean from each series. For example, see Box and Jenkins. (In fact, the usual way to compute the sample variance of any series is to first extract the mean.)
In economic applications, the usual approach is also to normalize by the product of the sample standard deviations of each series x(t) and y(t).
For a sample autocorrelation function (ACF), as computed by the Econometrics Toolbox function AUTOCORR, this has the added effect of producing an ACF whose value at lag zero is unity, since x(t) = y(t).
However, for CROSSCORR, the scaling does not ensure the XCF at lag zero is one.
Also, as mentioned in another response, for two series x and y, XCORR and CROSSCORR will compute the same XCF function for N lags (to within numerical precision) for calls like this:
c = xcorr(x  mean(x), y  mean(y), N, 'coeff'); C = crosscorr(y, x, N);
As far as which is correct, they're both correct ... it just depends on what you want.
HTH, Rick
"Iris Ehlert" wrote in message <jgjbe9$biq$1@newscl01ah.mathworks.com>... > Dear members of mathworks, > > I did a cross correlation for two time series both with xcorr.m and crosscorr.m. The results are completely different, which definitely shouldn't be the case, since the documentation for both functions describe the same. > > So I would really, really appreciate it, if you could tell me why this happens. > > I used the same lags, same series  so it is really the function itself causing the different results. > > Cheers, > ie.

