# How to interpret values of the autocorrelation sequence?

I know that (auto)correlation indicates the "degree of predictability" of a variable with respect of another. However, this is a vague notion. I know that a blank process should have an autocorrelation similar to a delta, since information of one sample shouldn't say anything about another. I would like to have a more meaningful way of interpreting the values of the autocorrelation sequence.

For example, if I have this two autocorrelation sequences,

I really don't know how to compare them since I have no meaningful understanding of the value the sequence takes for each lag.

• Autocorrelation functions are not solid areas as you have shown on your graphs but simple (single-valued) curves that don't cross themselves ever. Nov 3 '21 at 16:01
• @DilipSarwate The OP has posted functions. There are just too many samples to show as a single line.
– Peter K.
Nov 3 '21 at 16:15
• @DilipSarwate it is as peter commented, they are singled value functions. A zoom on the second for example, shows that that "slow" triangular shape is modulated by another triangular variation with period of 4 samples; the scale of 10^4 doesn't show it as there are too many samples Nov 3 '21 at 17:40

The autocorrelation signals you have shown are biased autocorrelation. The issue is that the higher lags have fewer data points to be used to estimate the correlation at those lags.

Another issue is that your original signal appears to have a DC (constant) offset. When the biased autocorrelation estimator is applied to a signal with a constant offset, the result is a triangular shaped function.

Detrend. de-mean, or apply a DC blocker to your signal before taking the autocorrelation and you'll get something more sensible (with fewer artifacts from known causes).

Here's an update.

The plots you have are not very useful because of the two issues I raised above: the mean is non-zero (hence the triangular baselines) and the biased estimator is used (hence the triangular envelopes).

Let's look at a simple example.

First, let's take a sinusoid offset by a constant value.

and find its autocorrelation.

Because of the durations I've chosen, the two effects I mentioned are more apparent: the "baseline" (value about which the autocorrelation swings) is triangular in shape and the "envelope" (the outline) is also triangular.

First, let's remove the mean of the signal before taking the autocorrelation.

That makes the baseline zero, so the only effect left is the envelope.

Now let's try to correct for the envelope.

That matches a little better with the understanding that the autocorrelation of $$\sin(\omega t + \phi)$$ should be $$\cos(\omega t)$$, though it's not perfect because of the shortcut I've taken to form it (see code below).

Now, back to the actual question you're asking:

# How to interpret values of the autocorrelation sequence?

As Knut says, it says given the value of the signal at time $$n$$, what is the signal likely to be at time $$n+m$$?

For signals like sinusoids, this means that the autocorrelation value at $$n+m$$ value will depend on the frequency of the sinusoid.

For signals like (band-limited) white noise, the autocorrelation value will be zero (or likely close to it for any particular noise realization).

# Python code

import matplotlib.pyplot as plt
import numpy as np

T = 1000
fs = 44100
t = np.arange(T)/fs
omega = 2*np.pi*1000
phi = 2*np.pi*0.8978941234
x = 1 + np.sin(omega*t + phi)

plt.figure(1)
plt.plot(x)

Rxx = np.correlate(x,x,  mode='full')
plt.figure(2)
plt.plot(Rxx)

Rxx2 = np.correlate(x-np.mean(x), x-np.mean(x), mode='full')
plt.figure(3)
plt.plot(Rxx2)

Rxx2un = np.divide(Rxx2, np.bartlett(len(Rxx2)))
plt.figure(4)
plt.plot(Rxx2un)

• Thank for your answer, Peter. I wasn't aware that I had a bias in the estimation. If you could you comment on the value of the autocorrelation, I would really appreciate it. Nov 3 '21 at 15:13
• "Original signal appears to have a DC offset" Huh? where are you seeing the original signal in the OP's question? Nov 3 '21 at 16:01
• @DilipSarwate Whenever there is a triangular shape like that in a discrete-time autocorrelation estimate, it's almost always because the original signal had a DC offset. No?
– Peter K.
Nov 3 '21 at 16:14

I think of auto correlation as «self similarity». In practice: line the signal up with a copy of itself. Step the copy one sample at a time. Multiply corresponding pair of samples from the two and take the sum.

It follows that the autocorr will have a peak when the lag is 0. If the waveform is periodic, self-similarity will be really large for multiples of that period. If the waveform is noise-like, contributions will tend to cancel, and the autocorr will be small for any lags besides 0.

-k