Context
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).
Problem
I don't understand how one can compute the auto/cross-correlation for a given dataset of discrete random variables with multiple realizations.
Example
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?