MATLAB Answers


Statistical difference between a number of matrices.

Asked by mashtine on 31 May 2016
Latest activity Edited by Star Strider
on 3 Jun 2016
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.


Sign in to comment.

1 Answer

Answer by Star Strider
on 31 May 2016
 Accepted Answer

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.
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.


That would probably require some pre-processing. The value you may want to test could be the slope of a linear regression as a function of wind speed. Parameters such as slopes have their own uncertainty measures, so those may be what you want to compare. If the slopes are not significantly different from zero, you would perhaps be using the confidence intervals of the slopes. If they included zero, the slope is not significant.
And with that, we have exhausted my knowledge of the sort of statistical approach you need. I have no idea what statistical test you would use to test the confidence intervals of a group of slopes that would also tell you what specific slopes were most different.
Not a problem! Definitely an accepted answer nonetheless and thank you for all your help and input
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.

Sign in to comment.