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

View source: R/groupwiseCMH.r

groupwiseCMHR Documentation

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,
  ...
)

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.

Details

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

Value

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

Author(s)

Salvatore Mangiafico, mangiafico@njaes.rutgers.edu

References

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

See Also

nominalSymmetryTest, pairwiseMcnemar, pairwiseNominalIndependence, pairwiseNominalMatrix

Examples

### 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)
                      

rcompanion documentation built on May 29, 2024, 8:42 a.m.