[Numpy-discussion] convention in numpy.correlate?

PGM pgmdevlist at gmail.com
Wed Sep 6 02:57:38 CDT 2006


Folks,
I need to compute some cross-correlations between time series, and I naturally 
started to use numpy.correlate. Howver, I'm not sure about the convention 
being used:
The crosscorrelation is usually defined as 
$\gamma_{xy}[k]  = \sum_{i}{x[i] y[i+k]}$
So, when I compute
>>> numpy.dot(x[:-1],y[1:])
on two 1D series of same size $n$, I should have $\gamma[1]$.
With numpy.correlate, I have to use 
>>>numpy.correlate(x,y,'full')[(n-1)-1]
or reverse x and y to get $\gamma[1]$
Is that correct ? 
P.




More information about the Numpy-discussion mailing list