I have two random matrices (matrix-valued random variables) $X$ and $Y$, both of dimension $n \times n$. Is there a notion of covariance between the two random matrices, i.e., $\text{Cov}(X,Y)$? If yes, how can I calculate it?
-
$\begingroup$ By "random matrices" do you mean in the theoretical sense of matrix-valued random variables, or do you mean that each is an array of realizations of random variables? In the first sense your question cannot be answered except very generally (by quoting the definition) while in the second sense you simply haven't enough data. $\endgroup$– whuber ♦Commented Mar 23, 2016 at 18:04
-
2$\begingroup$ You could vectorize (stack the columns of) each matrix and consider the covariance matrix between the two resulting vectors. $\endgroup$– Richard HardyCommented Mar 23, 2016 at 18:11
-
2$\begingroup$ Hi Whuber, I actually mean matrix-valued random variable. $\endgroup$– StellaLeeCommented Mar 23, 2016 at 18:19
1 Answer
The most common thing to do is probably to simply consider the covariance between the entries of the matrices. Defining $\DeclareMathOperator{\vec}{\mathrm{vec}}\vec(A)$ to be the vectorization of a matrix $A$ (that is, stack up the columns into a single column vector), you can look at $\DeclareMathOperator{\Cov}{\mathrm{Cov}}\Cov(\vec(X), \vec(Y))$. This is then an $mn \times mn$ matrix.
If you preferred, you could instead define an $m \times n \times m \times n$ tensor, which would be essentially the same thing, just reshaped.
In e.g. the matrix normal distribution, we assume that the covariance matrix of the single random matrix $X$ factors as the Kronecker product of an $m \times m$ row covariance $U$ and an $n \times n$ column covariance $V$, in which case you can often just work with $U$ or $V$.
-
1$\begingroup$ Thanks! Yes I am assuming they are matrix-valued random variables. I changed my question a little bit, it should be two square matrices. So what about the expectation of a product of two matrix-valued random variables? If there is no correlation I am assuming that the expectation of the two matrices is just the product of the expectation of the two matrices? I am asking this question because in my case the two matrices can be correlated and I wonder how to calculate the expectation of the product. I am assuming that we need to calculate the covariance? Thanks! $\endgroup$ Commented Mar 23, 2016 at 18:19
-
1$\begingroup$ @StellaLee To answer your comment-question in a comment (if it goes any further, you should ask this as a separate question): Note that $$\DeclareMathOperator{\E}{\mathbb E}\E[(X Y)_{ij}] = \E\left[\sum_k X_{ik} Y_{kj}\right] = \sum_k \E[X_{ik} Y_{kj}] = \sum_k \E[X_{ik}] \E[Y_{kj}] + \Cov(X_{ik}, Y_{kj}).$$ If you just want $\E[X Y]$, then doing it elementwise like this suffices, though if you want something like $\E[\lVert X Y \rVert]$ then it gets trickier. $\endgroup$– DanicaCommented Mar 23, 2016 at 18:25