groupwiseCMH.RdConducts groupwise tests of association on a three-way contingency table.
groupwiseCMH(
x,
group = 3,
fisher = TRUE,
gtest = FALSE,
chisq = FALSE,
method = "fdr",
correct = "none",
digits = 3,
...
)A three-way contingency table.
The dimension of the table to use as the grouping variable.
Will be 1, 2, or 3.
If TRUE, conducts Fisher exact test.
If TRUE, conducts G test of association.
If TRUE, conducts Chi-square test of association.
The method to use to adjust p-values. See ?p.adjust.
The correction to apply to the G test.
See GTest.
The number of digits for numbers in the output.
Other arguments passed to chisq.test or GTest.
A data frame of groups, test used, p-values, and adjusted p-values.
If more than one of fisher, gtest, or chisq is
set to TRUE, only one type of test of association
will be conducted.
### Post-hoc for Cochran-Mantel-Haenszel test
data(AndersonBias)
Table = xtabs(Count ~ Gender + Result + County,
data=AndersonBias)
ftable(Table)
#> County Bloom Cobblestone Dougal Heimlich
#> Gender Result
#> Female Pass 9 11 9 15
#> Fail 5 4 7 8
#> Male Pass 7 9 19 14
#> Fail 17 21 9 17
mantelhaen.test(Table)
#>
#> Mantel-Haenszel chi-squared test with continuity correction
#>
#> data: Table
#> Mantel-Haenszel X-squared = 6.7314, df = 1, p-value = 0.009473
#> alternative hypothesis: true common odds ratio is not equal to 1
#> 95 percent confidence interval:
#> 1.248399 4.260003
#> sample estimates:
#> common odds ratio
#> 2.306119
#>
groupwiseCMH(Table,
group = 3,
fisher = TRUE,
gtest = FALSE,
chisq = FALSE,
method = "fdr",
correct = "none",
digits = 3)
#>
#> Group Test p.value adj.p
#> 1 Bloom Fisher 0.0468 0.0936
#> 2 Cobblestone Fisher 0.0102 0.0408
#> 3 Dougal Fisher 0.5230 0.5230
#> 4 Heimlich Fisher 0.1750 0.2330