2
$\begingroup$

I've been asked to compute a Cochran-Mantel-Haenszel (CMH) Test on 2 variables :

  • one is an ordered factor from quantiles of a numeric value ("Q1", "Q2", "Q3", "Q4")
  • the other is an unordered factor from groups of a character value ("group A", "group B", "group C").

Both variables are usual values (columns) for a high number of observations (lines).

Based on the little Wikipedia page and the Biostat Handbook, I tried to understand what the CMH test is and here is what I understood :

Cochran–Mantel–Haenszel test for repeated tests of independence : Use the Cochran–Mantel–Haenszel test when you have data from 2×2 tables that you've repeated at different times or locations.

Then it seems it should be done over 3 factors : lines, cols and stratas :

There are three nominal variables: the two variables of the 2×2 test of independence, and the third nominal variable that identifies the repeats.

Indeed, in R, the mantelhaen.test {stats} function need 3 factors or a 3 dimensions array which makes sense.

On the other hand, in SAS, you can easily write a 2 factors CMH test :

PROC FREQ data=MY_DATA;
    TABLE VAR1 * VAR2 /CMH; /*or /CHISQ, which give the first MH pvalue too*/
    RUN;

The SAS documentation is not crystal clear about it, and examples are maid over 3 factors, but this 2 dimensions test runs normally and give you 3 statistics and p-values, including a "correlation" one. All stats and pvalues are different from a standard chisquare test.

This SAS doc link gives another definition of the CMH (sorry no anchor, search for "Mantel-Haenszel"), which is not what I understood from wikipedia. It states that :

The Mantel-Haenszel chi-square statistic tests the alternative hypothesis that there is a linear association between the row variable and the column variable. Both variables must lie on an ordinal scale.

I have to compute the CMH test with both R and SAS but I want to know what I am doing.

Thus, my questions are :

  • Is the SAS definition of CMH test correct ? If not, how can a big enterprise like SAS can afford to play like this ?
  • Can I reproduce it in R ? If yes, is the mantelhaen.test function adapted and why can't I put only 2 variables ?
$\endgroup$
2
  • $\begingroup$ What SAS is calling the CMH test is called the Cochran test of trend by many other authors. $\endgroup$
    – DWin
    Commented Apr 27, 2021 at 13:24
  • $\begingroup$ What SAS is calling the CMH test is called the Cochran test of trend (or Cochran-Armitage) by many other authors. stats.stackexchange.com/questions/539/… I think Cochran-Armitage is the label used by SPSS, hence its predominance in questions here. $\endgroup$
    – DWin
    Commented Apr 27, 2021 at 13:43

1 Answer 1

2
$\begingroup$

The problem seems to arise because the paper by Cochran and the paper by Mantel extending the paper by Mantel and Haenszel both cover a lot of ground so it is difficult to speak of one test unambiguously as being the CMH test. It is true that most people who call it Mantel-Haenszel mean a method for allowing for stratification of a $2\times2$ contingency table which is what the R function mantelhaen provides and which is discussed in the paper by Mantel and Haenszel. It is also true that in both the Cochran paper and the Mantel paper the issue for using a single degree of freedom test for a linear by linear association in an arbitrary sized contingency table is also discussed.

The Mantel paper is here
The Cochran paper is here
and the Mantel-Haenszel paper is here

$\endgroup$
5
  • $\begingroup$ Very interesting, thanks ! But then, do you know how to make the SAS CMH test in R ? Also, in a paper, since most people call for stratification CMH, am I allowed to say I made a CMH test when computed with SAS ? $\endgroup$ Commented Feb 8, 2018 at 15:41
  • $\begingroup$ I have never used SAS so cannot help there. I would have thought you might be better off with that specific issue on a SAS forum. I would call what SAS seems to do a test of linear by linear association to be unambiguous. $\endgroup$
    – mdewey
    Commented Feb 8, 2018 at 15:43
  • 1
    $\begingroup$ Obviously there can be confusion about the names of these tests, but as far as I've seen, Cochran-Mantel-Haenszel refers to the test for 3-way tables. The test for two ordinal variables is called a linear-by-linear test by Zar (Biostatistics), and it sounds like it is "Mantel-Haenszel chi-square" by SAS, and is included in the SPSS output for 2-way tables ("ordinal chi-square" ?)..... But it occurs to me that the data you have is neither a 3-way table nor a table of two ordinal variables.... $\endgroup$ Commented Feb 8, 2018 at 23:32
  • $\begingroup$ On SAS output: For the linear-by-linear test, when using proc freq and the cmh1 or cmh options, the test is listed under Cochran-Mantel-Haenszel Statistics. When using the chisq option it is called Mantel-Haenszel chi-square. $\endgroup$ Commented Oct 11, 2018 at 15:57
  • $\begingroup$ To answer the question by @DanChaltiel, about conducting the linear-by-linear test in R, you can use coin::lbl_test or vcdExtra::CMHtest. There are some examples on SAEPER, my own page, and I'm working on updating this page to include the confusion with the names of this test in R, SAS, and SPSS. $\endgroup$ Commented Oct 11, 2018 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.