Post-hoc tests for Cochran-Mantel-Haenszel test
groupwiseCMH.RdConducts 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, or3.- 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.testorGTest.
Details
If more than one of fisher, gtest, or chisq is
set to TRUE, only one type of test of association
will be conducted.
Author
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
Examples
### 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