Basically I have two matrices, something like this:
> Matrix A (100 rows x 2 features)
Height - Weight
1.48 75
1.55 65
1.60 70
etc...
And Matrix B (same dimension of Matrix A but with different values of course)
I would like to understand if there is some correlation between Matrix A and Matrix B, which strategy do you suggest me?
The concept you are looking for is known as canonical correlation. It is a well developed bit of theory in the field of multivariate analysis. Essentially, the idea is to find a linear combination of the columns in your first matrix and a linear combination of the columns in your second matrix, such that the correlation between the two linear combinations is maximized.
This can be done manually using eigenvectors and eigenvalues, but if you have the statistics toolbox, then Matlab has already got it packaged and ready to go for you. The function is called
canoncorr, and the documentation is hereA brief example of the usage of this function follows:
The first canonical correlation is the first element of
r, and the second canonical correlation is the second element ofr.The
canoncorrfunction also has a lot of other outputs. I’m not sure I’m clever enough to provide a satisfactory yet concise explanation of them here so instead I’m going to be lame and recommend you read up on it in a multivariate analysis textbook – most multivariate analysis textbooks will have a full chapter dedicated to canonical correlations.Finally, if you don’t have the statistics toolbox, then a quick google revealed the following FEX submission that claims to provide canonical correlation analysis – note, I haven’t tested it myself.