[R] R equivalent of SAS Cochran-Mantel-Haenszel tests?

Michael Friendly friendly at yorku.ca
Mon Feb 9 15:32:30 CET 2009

In SAS, for a two-way (or 3-way, stratified) table, the CMH option in 
3 tests that take ordinality of the factors into account, for both 
variables, just the column variable
or neither.   Is there an equivalent in R?
The mantelhaen.test in stats gives something quite different (a test of 
conditional independence for
*nominal* factors in a 3-way table).

e.g. I'd like to reproduce:
*-- CMH tests;
proc freq data=sexfun order=data;
  weight count;
  tables husband * wife / cmh chisq nocol norow;

                              The FREQ Procedure
                     Summary Statistics for Husband by Wife
          Cochran-Mantel-Haenszel Statistics (Based on Table Scores)

        Statistic    Alternative Hypothesis    DF       Value      Prob

            1        Nonzero Correlation        1     10.0142    0.0016
            2        Row Mean Scores Differ     3     12.5681    0.0057
            3        General Association        9     16.7689    0.0525

Michael Friendly     Email: friendly AT yorku DOT ca 
Professor, Psychology Dept.
York University      Voice: 416 736-5115 x66249 Fax: 416 736-5814
4700 Keele Street    http://www.math.yorku.ca/SCS/friendly.html
Toronto, ONT  M3J 1P3 CANADA

More information about the R-help mailing list