User:Dioxylin/sandbox

In statistics, the Cochran–Mantel–Haenszel statistics are a collection of test statistics used in the analysis of stratified categorical data. They are named after William G. Cochran, Nathan Mantel and William Haenszel. One of these test statistics is the Cochran–Mantel–Haenszel (CMH) test, which allows the comparison of two groups on a dichotomous/categorical response. It is used when the effect of the explanatory variable on the response variable is influenced by covariates that can be controlled. It is often used in observational studies where random assignment of subjects to different treatments cannot be controlled, but influencing covariates can.

In the CMH test, the data are arranged in a series of associated 2 &times; 2 contingency tables, the null hypothesis is that the observed response is independent of the treatment used in any 2 &times; 2 contingency table. The CMH test's use of associated 2 &times; 2 contingency tables increases the ability of the test to detect associations (the power of the test is increased).

Assumptions
The CMH test is most optimal when the odds ratio of each stratum are equal. The test for this can be accomplished using the Woolf test, Breslow-Day test, or Goodness-of-fit tests on the odds ratios over each stratum.

Formula
The Mantel-Haenszel test takes the form:

$$CMH = {\left[ \Sigma_k(n_{11k}) - \mu_{11k} \right]^2 \over {\Sigma_k var(n_{11k})}}$$

Cochran, in 1954, proposed to treat each tow as two independent binomials rather than following the hypergeometric distribution that the Mantel-Haenszel test assumed. He did this by substituting $$var(n_{11k}) = { n_{1+k}n_{2+k}n_{+1k}n_{+2k} / n^3_{++k} } $$.