When to use chi square, fisher independence and Cochran–Mantel–Haenszel test for independence/association

Chi square and fisher independence are equivalent but use fisher exact test when the number of samples is small.

Both require the comparison of a result for at most two categorical data, being the result a numeric value. For example you can test if the presence or not of a gene influence the presence or not of a desease, that is, two categorical data with two possible values each. The categorical data can have more than two possible values but you can not have more than two categorical data (2 way contingency table). The null hypothesis is that there is no inluence due to the second categorical data on the distribution from the first.

An special case when you have 3 categorical data is the Cochran–Mantel–Haenszel test, in this test you test if the third categorical data represent an influence in the distribution of the 2×2 contingency table given by the other two variables. The third variable represents a repetition or strata.

Look at thsi pages for a good explanation:




And this page, where is presented also the use of chi square test as a goodness of fit test: