Pontius Jr, Robert Gilmore and Ali Santacruz. 2014. Quantity, Exchange and Shift Components of Differences in a Square Contingency Table. International Journal of Remote Sensing 35(21): 7543-7554.
You can do the calculations with PontiusMatrix41.xlsx, which is available for free at www.clarku.edu/~rpontius, where you can also get the publication.
See videos on the technique at www.clarku.edu/~rpontius/videos.html
Article Quantity, exchange, and shift components of difference in a ...