For an assignment, I need to find the correlation matrix of a dataset with 100 random variables and 1000 realizations for each. (It's a stock market example).


I don't understand how one can compute the auto/cross-correlation for a given dataset of discrete random variables with multiple realizations.


If $x(n)$ is a random variable with three realizations. E.g. (some example I came up with):

$x(n) = \begin{Bmatrix} 2, & 1, & 3 \end{Bmatrix}$

Then how do you compute its autocorrelation $r_{xx}$?

I know that $r_{xx} = E[x(n)x^*(n-k)]$, which will result in a convolution function. I think it should be something like:

$\sum x(n)x(n-k) P(x=a_k,y=b_k)$ $\rightarrow$ $\frac{1}{N^2}\sum x(n)x(n-k)$

Because the probability of it having some set of values is $1/N^2 = 1/3^2$, I think.

However, I think this is completely wrong because this gives an array of values and I also tried computing a correlation matrix with $c_{xx} = r_{xx} - m_x^2$, and that gives different results.

I just really want to understand how it works, but I haven't been able to. I would really appreciate some help on this matter.

Thanks in advance!

Better example to make my issue clearer

Say $x(n) = \begin{Bmatrix} (n=0) & (n=1) & (n=2) & (n=3) \\ 2 & 1 & 3 & 4\\ 1 & 2 & 1 & 3 \\ 1 & 3 & 2 & 3 \end{Bmatrix}$

With the time index on the horizontal and the different realizations on the vertical. How does the autocorrelation computation process work?

  • 3
    $\begingroup$ I’m voting to close this question because this is about statistics, not about signal processing. I'd recommend migration to stats.stackexchange.com $\endgroup$ Commented Oct 4, 2021 at 14:31
  • $\begingroup$ (also, you're confusing "auto-/crosscorrelation", which is a property of a stochastic process as a whole, not of a realization, with "empiric correlation", which is computed on a set of given data points. That's the whole problem here.) $\endgroup$ Commented Oct 4, 2021 at 14:32
  • $\begingroup$ Correlation in this form does not seem to be a big concept in statistics, but it is commonly used in my Signal Processing course, so that's why I posted here. $\endgroup$
    – Wirral
    Commented Oct 4, 2021 at 17:04
  • $\begingroup$ it definitely is a big concept in statistics :) $\endgroup$ Commented Oct 4, 2021 at 17:13
  • 1
    $\begingroup$ Hi: correlation is defined differently in digital signal processing versus statistics. There have been many DSP discussions on this in the past so I didn't want to go near this question. If you want the statistical viewpoint, you can send to cross-validated. If you want the DSP viewpoint, stay here. Note that, your question is also difficult because you use the term autocorrelation a lot in your discussion which is a very different thing from normalized covariance. I have a feeling you mean normalized covariance which, in statistics, is referred to as correlation. $\endgroup$
    – mark leeds
    Commented Oct 5, 2021 at 1:13


Your Answer

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