4
$\begingroup$

Autocorrelation is the cross-correlation of a signal with itself, and autocovariance is the cross-covariance of a signal with itself.

According to https://www.mathworks.com/help/signal/ug/correlation-and-covariance.html the cross-correlation two wide-sense stationary random process, $x(n)$ and $y(n)$ is :

$R_{xy}(m) = E\{x(n+m)y(n) \}$

whereas the cross-covariance is defined as:

$C_{xy}(m) = E\{(x(n+m)-\mu_x) (y(n)-\mu_y) \} = R_{xy}(m) - \mu_x\mu_y$

However, statsmodels https://www.statsmodels.org/stable/_modules/statsmodels/tsa/stattools.html calls in its function for the autocorrelation (acf) the autocovariance function (acovf):

avf = acovf(x, unbiased=unbiased, demean=True, fft=fft, missing=missing)

where acovf subtracts the mean since demean is set to True.

xo = x - x.mean()

But according to the definition, the cross-correlation is simply the dot product without subtracting the mean. What am I not getting here?

$\endgroup$

1 Answer 1

3
$\begingroup$

You're getting everything correct. There is unfortunately inconsistency over the terms auto-correlation and cross-correlation in time-series and signal processing literatures. The mathworks link you shared is a signal processing toolbox, and defines auto and cross correlations without demeaning and normalizing, just as in the wikipedia page. The Normalization section of the wikipedia page notes down this difference. In time-series courses/lectures you'll see the normalized version of auto-covariance as your auto-correlation function, which is the definition statsmodels uses.

$\endgroup$
1
  • 2
    $\begingroup$ Looks like the signal processing literature is abusing/redefining statistical terms. (I do not think it is the other way around, at least by historical precedence.) $\endgroup$ Commented Jan 31, 2020 at 18:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.