I have a set of data described by two qualitative variables. The data can therefore be analysed as a matrix, showing the intersectionshow many occurrences there are at each intersection of the two variables' levels that have many (or few) occurrences.
I am looking for a measure to express the difference between two of such matrices : the first, in which all intersections of the two variables are equally populated (uniform distribution), and the second, in which some intersections are much more (or much less) populated than others.
These Here are two matrices like the ones I have: they are counts of positive integers in all cells (r code).
m1 <- matrix(c(3,3,3,
3,3,3,
3,3,3), nrow = 3nrow=3, ncol =ncol=3, 3byrow=TRUE)
m2 <- matrix(c(6,0,3,3,6,3,0,
0,6),0,
nrow = 3,3,6), ncolnrow=3, =ncol=3, 3byrow=TRUE)
I want to express the idea the the first matrix is more uniform than the second. Is there a measure that I can use? I I believe that there should be a straightforward answer, something like a generalisation of variance for matrices. I just want to be sure to get the right one.