fisher.posthoc | R Documentation |
Conducts pairwise tests for a 2-dimensional matrix, in which at at least one dimension has more than two levels, as a post-hoc test. Conducts Fisher exact, Chi-square, or G-test.
fisher.posthoc(
x,
compare = "row",
fisher = TRUE,
gtest = TRUE,
chisq = TRUE,
method = "fdr",
correct = "none",
cramer = FALSE,
digits = 3,
...
)
x |
A two-way contingency table. At least one dimension should have more than two levels. |
compare |
If |
fisher |
If |
gtest |
If |
chisq |
If |
method |
The method to adjust multiple p-values.
See |
correct |
The correction method to pass to |
cramer |
If |
digits |
The number of significant digits in the output. |
... |
Additional arguments, passed to |
A data frame of comparisons, p-values, and adjusted p-values.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
http://rcompanion.org/handbook/H_04.html
pairwiseMcnemar
, groupwiseCMH
,
nominalSymmetryTest
,
pairwiseNominalMatrix
# posthoc for fisher, essentially fisher and then apply fdr correction
# pairwiseNominalIndependence from rcompansion
# nbk %>% ez.factorelevel(c('dx','race'))->tmp
# table(tmp$dx,tmp$race) %>% fisher.posthoc()
# note: table(tmp$race,tmp$dx) %>% fisher.posthoc() is different
# also similar function from RVAideMemoire::fisher.multcomp
# but this funciton can do all (fisher, chisq and g-test)
### Independence test for a 4 x 2 matrix
data(Anderson)
fisher.test(Anderson)
Anderson = Anderson[(c("Heimlich", "Bloom", "Dougal", "Cobblestone")),]
PT = fisher.posthoc(Anderson,
fisher = TRUE,
gtest = FALSE,
chisq = FALSE,
cramer = TRUE)
PT
cldList(comparison = PT$Comparison,
p.value = PT$p.adj.Fisher,
threshold = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.