# how to assess matris/areas overlapping

#### modestprog

##### New Member
I have two binary matrixes, of the same size (e.j. 5000x5000). Those matrixes represent the same area, divided in cells of the same size. Each cell of one matrix can be true or false, meaning some property is present or not in this cell. One matrix represents the presence of a property A, and the other one the property B.
Therefore, I can easily build a 2x2 contingency table using as variables the presence/absence of A and B.
And I can apply a chi-square test on this table, building an "expected" contingency table, to asses the independency of both properties.
But I also need to assess if the number of cells that "overlap" (are true in both matrixes, i.e. where both A and B are present) is higher or lower than expected if both properties were independent. Of course I can compare values between the real and the expected contingency tables, but what I need is some thing like a probability or a measure of how overlap is higher or lower than expected. In some way, it can also be seen as a measure of the "correlation" between both properties?
I know if I had a smaller number of cells I could use Fisher's exact test, where obtained p-value will indicate the "direction" of the relationship between A and B. But as Fisher's exact test implies factorials, it is not possible.

There is another simple test (preferably if it is easy to program in a language such as C#) I could use for this aim?
Thank you very much for any help!