Learn R Programming

rcompanion (version 2.4.30)

groupwiseCMH: Post-hoc tests for Cochran-Mantel-Haenszel test

Description

Conducts groupwise tests of association on a three-way contingency table.

Usage

groupwiseCMH(
  x,
  group = 3,
  fisher = TRUE,
  gtest = FALSE,
  chisq = FALSE,
  method = "fdr",
  correct = "none",
  digits = 3,
  ...
)

Value

A data frame of groups, test used, p-values, and adjusted p-values.

Arguments

x

A three-way contingency table.

group

The dimension of the table to use as the grouping variable. Will be 1, 2, or 3.

fisher

If TRUE, conducts Fisher exact test.

gtest

If TRUE, conducts G test of association.

chisq

If TRUE, conducts Chi-square test of association.

method

The method to use to adjust p-values. See ?p.adjust.

correct

The correction to apply to the G test. See GTest.

digits

The number of digits for numbers in the output.

...

Other arguments passed to chisq.test or GTest.

Author

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

Details

If more than one of fisher, gtest, or chisq is set to TRUE, only one type of test of association will be conducted.

References

http://rcompanion.org/handbook/H_06.html

See Also

nominalSymmetryTest, pairwiseMcnemar, pairwiseNominalIndependence, pairwiseNominalMatrix

Examples

Run this code
### Post-hoc for Cochran-Mantel-Haenszel test
data(AndersonBias)
Table = xtabs(Count ~ Gender + Result + County,
              data=AndersonBias)
ftable(Table)
mantelhaen.test(Table)
groupwiseCMH(Table,
             group   = 3,
             fisher  = TRUE,
             gtest   = FALSE,
             chisq   = FALSE,
             method  = "fdr",
             correct = "none",
             digits  = 3)
                      

Run the code above in your browser using DataLab