# mantelHaenszel: Cochran-Mantel-Haenszel Chi-Squared Test for Count Data In biostatUZH: Misc Tools of the Department of Biostatistics, EBPI, University of Zurich

## Description

Compute Cochran-Mantel-Haenszel chi-squared test of the null that two nominal variables are conditionally independent in each stratum, assuming that there is no three-way interaction.

## Usage

 `1` ```mantelHaenszel(exposure, outcome, stratum) ```

## Arguments

 `exposure` Binary variable coding whether patient was exposed (1) or not (0). `outcome` Binary variable coding outcome of patient. `stratum` Nominal variable containing information about matching, i.e. strata.

## Value

 `tab` Table that counts numbers of strata for each case-control combination. `test.stat` Test statistic for chi^2 test. `p.val` p-value of chi^2 test.

## Author(s)

Kaspar Rufibach
[email protected]

## References

Agresti, A. (2002). Categorical data analysis. New York: Wiley.

Similar functionality is provided in `mantelhaen.test` and `clogit` in survival. See the examples below for a comparison.
 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20``` ```# generate data set.seed(1977) exposure <- rep(c(1, 0, 0, 0, 0), 41) outcome <- sample(c(rep(1, 62), rep(0, 5 * 41 - 62))) strata <- rep(1:41, each = 5) # via conditional logistic regression logreg <- clogit(outcome ~ exposure + strata(strata), method = "approximate") summary(logreg) # R function in library 'stats' mh <- mantelhaen.test(x = outcome, y = exposure, z = strata) # this function mH <- mantelHaenszel(exposure, outcome, strata) # compare p-values summary(logreg)\$coef[5] mh\$p.value mH\$p.val ```