Every second, a device returns the value 0 or 1. The values were recorded several hours, so a list like this one [1,1,1,0,0,1,0,1,...] was obtained.

What is the meaning of the corresponding autocorrelation function? I suspect that it is somehow related to the frequencies in which the device changes its outputs (from 0 to 1 or from 1 to 0), but I can't get a clear picture of it.


1 Answer 1


Your intuition is correct.

There are various definitions of the autocorrelation: see Understanding this acf output for a discussion of some of the pitfalls. But for a sufficiently long sequence all definitions will produce essentially the same value. One of these definitions is that the autocorrelation of the sequence at a small lag $h$ is the (usual) Pearson correlation coefficient when each term of the sequence is paired with the term occurring $h$ time steps later.

There are only four possible values of such pairs. Letting $q$ be the proportion of ones in the sequence,

  • Let $\alpha$ be the proportion of $(1,1)$ pairs. This is the fraction of the time the device was in state $1$ and, $h$ time steps later, it was also in state $1.$

  • The proportion of $(1,0)$ pairs therefore must be very close to $q-\alpha.$

  • Likewise, the proportion of $(0,1)$ pairs must also be very close to $q-\alpha.$

  • Thus, the proportion of $(0,0)$ pairs must be the amount needed to make the total equal to unity, $1+\alpha-2q.$

These proportions determine the correlation coefficient $\rho$: just apply the formula. Thinking of the pairs as a bivariate random variable $(X,Y),$ you will obtain

$$\rho = \frac{E[XY]- E[X]E[Y]}{\sqrt{\left(E[X^2]-E[X]^2\right)\left(E[Y^2]-E[Y]^2\right)}} = \frac{\alpha - q^2}{q(1-q)}. $$

The more directly interpretable statistic is $\alpha/q,$ the chance the device will output a $1$ given that it output a $1$ $h$ steps earlier. We can express this as

$$\Pr(1\mid 1) = \frac{\alpha}{q} = q + \rho(1-q).$$

If there were no correlation ($\rho=0$), the conditional probability (of $1$ following a $1$ with lag $h$) would be the same as the unconditional probability of $1:$ that's independence. Otherwise,

The correlation coefficient $\rho$ expresses how much the conditional probability $\Pr(1\mid 1)$ differs from the proportion of ones ($q$) as a multiple of the proportion of zeros, $1-q.$

Equivalently, we may formulate an interpretation in terms of the conditional chance of making a transition from $1$ to $0,$ since

$$\Pr(0 \mid 1) = 1 - \Pr(1\mid 1) = 1 - q - \rho(1-q) = (1-q)(1-\rho).$$

In this fashion $\rho$ (along with the proportion of ones) is directly related to the frequency of such transitions. In words: the proportion of zeros following a one is $1-\rho$ times the proportion of all zeros (to an excellent approximation).

There's nothing special about the roles of $0$ and $1$ in this interpretation: since interchanging $0$ and $1$ is a linear function $x \to 1-x,$ it doesn't change the correlation. It merely changes $q$ to $1-q.$ Thus, in the foregoing interpretation you may switch all occurrences of "$0$" and "$1$" provided you replace $q$ by $1-q$ everywhere and replace $\alpha$ by $1+\alpha-2q.$ Thus

$$\Pr(0\mid 0) = \frac{1+\alpha-2q}{1-q} = 1-q + \rho(q)$$


$$\Pr(1 \mid 0) = q(1-\rho).$$

Although I have sometimes used the language and symbolism of probabilities, these statements are, strictly speaking, only about proportions (and they are approximations that are most accurate for long sequences and short lags, because they ignore effects at the ends of the sequences). Thus, nothing is assumed or implied about the nature of the process that generated the sequence. In particular, although we have related transition rates at any lag to the autocorrelation coefficient at that lag, this does not imply that the sequence was generated by any kind of Markov process (of any order), or even that it is stationary.

  • 1
    $\begingroup$ +1 Your response is admirable. Thank you very much, that's exactly what I wanted to know. $\endgroup$ Commented Jul 4, 2021 at 17:18
  • $\begingroup$ See stats.stackexchange.com/a/574544/919 for further analysis of the implicit restrictions on the values of the parameters $\alpha,$ $q,$ and $\rho.$ $\endgroup$
    – whuber
    Commented Dec 15, 2023 at 19:34

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.