# Compare column distribution with row margin (count matrix) given many expected values near zero

Background: I have an $n \times m$ matrix with count data. The rows contain $n$ semantic categories (in my case 19). Each column contains 10 entries and each entry is assigned to one row category (row). The row margin totals give an estimate of the relative occurrence of each category (row).

      |  c1  c2  c3 ... c10  | totals
----+----------------------+--------
r1  |   0   4   0  ...  2  |  6
r2  |   1   0   4  ...  3  | 11
r3  |   3   2   1  ...  1  |  7
.   |   .   .   .       .  |  .
.   |   .   .   .       .  |  .
rn  |   0   1   3  ...  0  |  6
----+----------------------+--------
total |  10  10  10      10  | 100


Now, I want to test the hypothesis, that the distribution of counts in a column is identical to the row margin distribution. For me this translated to a standard $\chi^2$-test. As the assumptions are violated due to the small sample size (many sampling zeros) I would opt for Fisher's exact test. I do not have structural zeros in the table. The lowest probability of a count occurring in a specific row in one column is around $.03$. With $10$ observations this gives me an expected count of under 1, i.e. $.3$. My problem: I am not sure whether Fisher's exact test assumptions are really met here. Is this the way to go or are there better alternatives?

• One alternative would be to a bootstrap/simulation. Generate a large number of 10x10 matrices where your null is true; define some measure of how far they are from your null; see how many are as far or farther from the null as the matrix you have. Commented Sep 26, 2013 at 10:42

Use of Fisher's exact test would be valid here, I think. With R, it is implemented in the function chisq.test using the argument sim=TRUE. An alternative, as said in a comment by @Peter Flom, is to use bootstrap. One paper advocating the bootstrap in this case is A Revisit to Contingency Table and Tests of Independence: Bootstrap is Preferred to Chi-Square Approximations as Well as Fisher’s Exact Test.