# [pymvpa] correlation between 2 matrices

David Soto d.soto at bcbl.eu
Fri Oct 28 21:24:07 UTC 2016

```thanks that is useful, however to clarify I meant it to be in the context of a representational similarity analyses
so would this solution be similar option 7 in here ? http://www.pymvpa.org/generated/mvpa2.measures.rsa.pdist.html
how about if I wanted to use a euclidean distance? not sure it could handle 2 spatio-temporal matrices
best
david

From: "Brian Murphy" <brian.murphy at qub.ac.uk>
To: "Development and support of PyMVPA" <pkg-exppsy-pymvpa at lists.alioth.debian.org>
Sent: Friday, October 28, 2016 9:58:45 PM
Subject: Re: [pymvpa] correlation between 2 matrices

If I understand your query correctly, I think numpy could do it, first by flattening the matrices to simple vectors, and then calculating the correlation between those, e.g.

np.corrcoef(np.array(matrix1).flatten(), np.array(matrix2).flatten())

... assuming you're using the matrix datatype. If they are vanilla 2D arrays, then you shouldn't need to recast:

np.corrcoef(matrix1.flatten(), matrix2.flatten())

best,

Brian

On 28/10/16 20:44, David Soto wrote:

hi,

I wonder whether PyMVPA can compute a similarity index (correlation) between two 2D matrices, each comprised of 12 seconds & 300 voxels?

thanks!
david

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa

_______________________________________________
Pkg-ExpPsy-PyMVPA mailing list
Pkg-ExpPsy-PyMVPA at lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-exppsy-pymvpa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/pkg-exppsy-pymvpa/attachments/20161028/d7bfb223/attachment.html>
```