1
$\begingroup$

I have two matrices A and B of the same dimensions. Each cell a(i,j) represents some parameter I'm interested in, and b(i,j) represents the corresponding value in the other matrix. The cells are not interrelated. What's the best way to represent how close these two matrices are?

The entries in these matrices are the number of occurrences of some event out of a large sample of events. If this is the case, does the problem make more sense?

$\endgroup$
2
$\begingroup$

If the cells are not interrelated then the fact that they are in matrices rather than just equal length columns of numbers doesn't matter, right?

Given they are counts, a suitable way of comparing them is probably the sum of squared differences, weighted by the inverse of the average of the two observations for each comparison cell.

$\sum\frac{(a_{i,j}-b_{i,j})^2}{(a_{i,j}+b_{i,j})/2}$

But what does this tell you about "how close", except that smaller means closer? Turning this statistic into something you can compare to any other number would depend on why you are doing this eg are there a range of candidate Bs trying to look like A.

$\endgroup$
1
$\begingroup$

I would use a suitably-defined inner product: $s_{A,B}=\left< A,B\right>$. If $A$ and $B$ are square, you could use $s=\mathrm {tr} (A B^T)$. If you want the result to be normalized you should divide by the norm.

The entries in these matrices are the number of occurrences of some event out of a large sample of events. If this is the case, does the problem make more sense?

This tells us the entries are non-negative so it does provide information.

$\endgroup$
4
  • $\begingroup$ I may not be thinking straight but I'm having trouble figuring out how to interpret $s$. $\endgroup$
    – Macro
    Apr 18 '12 at 0:43
  • 1
    $\begingroup$ The inner product is maximized when the two vectors are collinear, and zero when they are perpendicular. The particular example I gave simply meets the requirements of an inner product. $\endgroup$
    – Emre
    Apr 18 '12 at 1:01
  • $\begingroup$ Collinear isn't the same as "close" though. If every element of B were 100 times its equivalent in A that probably wouldn't meet the OP's need (although they probably need to be more precise about what they mean). $\endgroup$ Apr 18 '12 at 1:39
  • $\begingroup$ I think it would still be useful as is if A and B are snapshots at different times. Then B would be collinear with A assuming a constant rate of events. Normalizing each matrix before taking the inner product would also solve the "problem". $\endgroup$
    – Emre
    Apr 18 '12 at 2:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.