mantelHaenszel: Cochran-Mantel-Haenszel Chi-Squared Test for Count Data

Description Usage Arguments Value Author(s) References See Also Examples

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
kaspar.rufibach@gmail.com

References

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

See Also

Similar functionality is provided in mantelhaen.test and clogit in survival. See the examples below for a comparison.

Examples

 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


Search within the biostatUZH package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.