|
Roger thanks for your response.
How does one interpret the xcorr result then? Is it flat out wrong?
James
"Roger Stafford" wrote in message <jjmeh4$bec$1@newscl01ah.mathworks.com>...
> "James " <jfaghm@googlemail.com> wrote in message <jjmald$lc$1@newscl01ah.mathworks.com>...
> > I am trying to computer to linear correlation between two timeseries.
> > xcorr(X,Y,0,'coeff) = 0.9056; corr(X,Y) = -0.41
> > I don't understand how we could have such different results?! When you look at the two time-series they are clearly anti-correlated. Can somebody explain why we get such results using xcorr?
> > Figure: http://dl.dropbox.com/u/6156036/corr_plot.jpg
> - - - - - - - - - -
> Those two functions are computing entirely different kinds of "correlation". The Statistics Toolbox 'corr' function computes the Pearson correlation in which the mean value is subtracted before the product is taken, whereas the Signal Processing Toolbox 'xcorr' does not. If I interpret your curves correctly their values are all well above zero, so that this difference in the functions' definitions has a large effect on the results. For 'xcorr' you would expect a very positive figure and for 'corr', based on the appearance of the curves, a negative value.
>
> In calculating correlation you need to be aware of how it is defined by the various kinds of "correlation" functions. It has a number of different definitions. It is prudent to always experiment with each one using very short sequences to see if their computations agree with what you think they should be.
>
> Roger Stafford
|