Normalized mutual entropy provides a measure of the diversity of a two dimensional matrix. It takes mutual entropy and normalizes for the marginal entropy of the variable of interest (column variable in the code). See screen shot or embedded references for formula.
This code is used for the estimation of biodiversity in ecological systems, but is not limited to such applications. The code can be used in any system where the diversity of variable interactions is of interest. Please see follow-ups for code written for the inclusion of more than two variables.