metanumerics icon indicating copy to clipboard operation
metanumerics copied to clipboard

Fisher Exact Test for arbitrary contingency tables

Open dcwuser opened this issue 6 years ago • 0 comments

The Kuiper Exact Test is generalizable to r X c contingency tables. Just iterate over all tables with the same marginal totals, compute the probability of each, and add up all the probabilities less than or equal to the one observed.

The number of degrees of freedom is r * c - r - c + 1. For example:

  • 2 X 2: 4 - 2 - 2 + 1 = 1
  • 3 X 2: 6 - 3 - 2 + 1 = 2
  • 3 X 3: 9 - 3 - 3 + 1 = 4
  • 4 X 2: 8 - 4 - 2 + 1 = 3
  • 4 X 3: 12 - 4 - 3 + 1 = 4
  • 4 X 4: 16 - 4 - 4 + 1 = 9

Only 2 X 2 has only a single degree of freedom corresponding to a hyper-geometrically distributed variable, which is why it is the one most commonly supported.

Others can be supported via enumeration of multiple degrees of freedom, or via Monte Carlo simulation. Here is a recent article about the latter: https://arxiv.org/pdf/1507.00070.pdf

dcwuser avatar Mar 12 '18 22:03 dcwuser