3
$\begingroup$

This post on Stack Overflow says that the autocorrelation, or self correlation, of vectors is defined as

$$C(t, \{v\}_n) = \frac {1}{n-t}\sum_{i=0}^{n-1-t}\vec v_i\cdot\vec v_{i+t}$$

What is the source of this formula? Can you give me a reference?

$\endgroup$
2

1 Answer 1

4
+100
$\begingroup$

Ignore baldly asserted formulae with undefined variables, etc., found on internet sites

The linked formula does not even specify the meaning of the variables entering the notation, and it contains no textual explanation, justification, specification of assumptions, etc. The formula appears prima facie to be incorrect as a general result --- it appears to assume standardisation of variables without any statement to this effect (and in contradiction to the data shown in the linked post). As with any bald assertion of a partially defined formula found on an internet site, it should simply be ignored.

Based on the form of the stated formula, it appears to be giving the sample autocorrelation for a standardised vector and also appears to be incompatible with the data used in the same post. The sample autocorrelation for autocorrelated data with known mean and variance is as follows. Consider a vector $\mathbf{v} = (v_1,...,v_n)$ with elements having known mean $\mu$ and known variance $\sigma^2$. The sample autocorrelation at lag $t$ is the sample correlation between the subvectors $\mathbf{v}_{1:n-t} = (v_1,...,v_{n-t})$ and $\mathbf{v}_{t+1:n} = (v_{t+1},...,v_n)$, which is:

$$\begin{align} \widehat{\mathbb{Corr}}(t) &\equiv \widehat{\mathbb{Corr}}(\mathbf{v}_{1:n-t}, \mathbf{v}_{t+1:n}|\mu, \sigma^2) \\[12pt] &= \frac{\widehat{\mathbb{Cov}}(\mathbf{v}_{1:n-t}, \mathbf{v}_{t+1:n}|\mu)}{\sigma^2} \\[6pt] &= \frac{1}{\sigma^2} \cdot \frac{1}{n-t} \sum_{i=1}^{n-t} (v_i - \mu) (v_{t+i} - \mu). \\[6pt] \end{align}$$

(Note that the absence of Bessel's correction in the sample covariance formula is due to the fact that the mean is assumed to be known.) In the special case where $\mu=0$ and $\sigma=1$ this reduces to:

$$\widehat{\mathbb{Corr}}(t) = \frac{1}{n-t} \sum_{i=1}^{n-t} v_i v_{t+i}.$$

Presumably the formula in the linked post is referring to something like this sample correlation coefficient, but the data in the post is not consistent with the stipulated known mean and variance.

$\endgroup$
2
  • $\begingroup$ Your answer's narration is inconclusive. Are you showing the correct formula, or are you saying that your given formula could be the formula but you are not sure? $\endgroup$
    – user366312
    Commented Jul 28 at 9:57
  • $\begingroup$ You mixed up the review and conclusion. $\endgroup$
    – user366312
    Commented Jul 28 at 9:59

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.