[R] Comparing two matrices

Sarah Goslee
Tue, 03 Mar 2009 16:54:03 -0000

Hi,

For the Mantel test, your matrices do not need to be Euclidean, but they
do need to be symmetric. You could write a similar test that does not
require a symmetric matrix, though.

Sarah

On Tue, Mar 3, 2009 at 11:40 AM, Koen Hufkens <koen.hufkens at ua.ac.be>
wrote:
> Hi List,
>
> I would like to compare two (confusion) matrices. I ended up with the ade4
> mantel.rtest function as my best option. However it seems that my data is
> non-euclidean in nature (is.euclid gives a FALSE). I attached both matrices
> at the end of the document.
>
> Are there any tools to transform these matrices into an euclidean form so I
> can use mantel.rtest with confidence.
>
> Other suggestions are also welcome.
>
> Kind regards,
> Koen
>
> --
>
> matrix 1
>
>   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
> 1   0 60  5  0  9  3  3  0 18   1   1
> 2  30  0 12  0  2 45  1  0  5   4   1
> 3   8 32  0  1 19  5  4  0 27   1   3
> 4   0  0  3  0 67  1  3  0  0   0  25
> 5  12  3 13 26  0 12 27  0  3   2   2
> 6   1 72  1  0  4  0 11  0  0  10   1
> 7   3  2  9  0 45 40  0  0  0   0   0
> 8  13  3  0  0  0  1  0  0 10   0  72
> 9  24 26 34  0  6  2  0  2  0   2   4
> 10  2 21  1  0  1 67  0  0  1   0   6
> 11  2  2 28 11 10 10  0 22  3  13   0
>
> matrix 2
>
>   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11
> 1   0 66  0 10  9  5  0  3  7   0   0
> 2  43  0  0 14  2 32  0  1  5   3   0
> 3  11 32  4  0 19 10  1  7 13   2   0
> 4   0  0  0  0  0  0  0  0  0   0   0
> 5  11  6  4 18  0 15 18 22  4   1   0
> 6   2 40  3  3 12  0  1 24  1  14   0
> 7   4  5  0  8 32 49  2  0  0   0   0
> 8   0  0  0  0  0  0  0  0  0   0   0
> 9  19 23  2 42  8  2  0  0  0   3   1
> 10  1 16  3  3  3 73  0  0  2   0   0
> 11  2  4  0 20 15 10 15  0 10   7  17
>


--
Sarah Goslee