# Two different definitions of autocorrelation?

Hi,

I’m used to the following definition of autocorrelation:

R(\tau) = \frac{<(X_t - \mu)(X_{t+\tau}-\mu)>}{\sigma^2}

However, it looks like acorr is just giving me

R(\tau) = \sum{X_t*X_{t+\tau}}

Just specifying normed=True doesn’t get the first formula. Is there some trivial option that I’ve missed?

Here’s what I did:

It’s easy enough to subtract \mu from my timeseries, but when I ask acorr to normalize things for me, I get the whole timeseries normalized by the value of R(0):

if normed: c/= np.dot(x,x)


I really do want the formula I gave, which requires each point of the autocorrelation to be averaged separately. So, I modified my local version of acorr to say

if normed:
nrm = arange(len(x))
nrm = hstack((nrm,nrm[:-1][::-1]))*std(x)**2
c /= nrm


Thanks,

-michael

···

Michael Lerner, Ph.D.
IRTA Postdoctoral Fellow
Laboratory of Computational Biology NIH/NHLBI
5635 Fishers Lane, Room T909, MSC 9314
Rockville, MD 20852 (UPS/FedEx/Reality)
Bethesda MD 20892-9314 (USPS)