# Statistical difference between a number of matrices.

17 views (last 30 days)
mashtine on 31 May 2016
Edited: Star Strider on 3 Jun 2016
Hey,
I am trying to find a statistical approach to comparing the differences between matrices in a 3D matrix. I have a 3D matrix of m,n,z and I would like to look have a statistical measure (ideally a m,n matrix) that shows where the matrices most differ or are statistically different from their mean value.
I have come across a few tests from the statistical tool box that do this between two matrices, or even between 2 3D matrices, but I am not sure how to apply it to one 3D matrix. Perhaps a t-test (normalized by the mean) along the z axis that produces a mxn matrix of p-values would work here.
Hope my question makes sense.

Star Strider on 31 May 2016
If I understand correctly what you want to do, I would reshape it so that the entries along the third dimension of your original matrix are the columns of your reshaped matrix. Then choose a test (I’m using anova1 here), then use the multcompare function.
Example:
M = randi(9, 3, 4, 3) % Create Data
Mr = reshape(M, [], 3)' % Reshape (Obviously)
[p, t, stats] = anova1(Mr); % Create ‘stats’ Structure
[c,m,h,nms] = multcompare(stats); % Do Multiple Comparisons
There are likely a number of different approaches you can take. This is the one I consider most appropriate.
Star Strider on 1 Jun 2016
As always, my pleasure!
EDIT (2016 06 03 at 18:00 UCT)
I thought about this a bit more, and came up with the idea of taking the confidence limits of the slope for each regression and multiplying them together to create a new sort of variable. The non-significant ones will be large and negative, and the highly significant ones will likely be large and positive, with the others in between. I’ve not tested this idea, but it — or something like it — might be worth considering.