Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: difference between xcorr and crosscorr?
Replies: 6   Last Post: Nov 29, 2012 1:43 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Rick

Posts: 11
Registered: 3/5/10
Re: difference between xcorr and crosscorr?
Posted: Oct 18, 2012 11:55 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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 auto-correlation 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.




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.