View source: R/pairwiseMcnemar.r
pairwiseMcnemar | R Documentation |
Conducts pairwise McNemar, exact, and permutation tests as a post-hoc to Cochran Q test.
pairwiseMcnemar(
formula = NULL,
data = NULL,
x = NULL,
g = NULL,
block = NULL,
test = "exact",
method = "fdr",
digits = 3,
correct = FALSE
)
formula |
A formula indicating the measurement variable and the grouping variable. e.g. y ~ group | block. |
data |
The data frame to use. |
x |
The response variable. |
g |
The grouping variable. |
block |
The blocking variable. |
test |
If |
method |
The method for adjusting multiple p-values.
See |
digits |
The number of significant digits in the output. |
correct |
If |
The component tables for the pairwise tests must be of size 2 x 2.
The input should include either formula
and data
;
or x
, g
, and block
.
A list containing: a data frame of results of the global test; a data frame of results of the pairwise results; and a data frame mentioning the p-value adjustment method.
The parsing of the formula is simplistic. The first variable on the left side is used as the measurement variable. The first variable on the right side is used for the grouping variable. The second variable on the right side is used for the blocking variable.
Salvatore Mangiafico, mangiafico@njaes.rutgers.edu
https://rcompanion.org/handbook/H_07.html
nominalSymmetryTest
,
groupwiseCMH
,
pairwiseNominalIndependence
,
pairwiseNominalMatrix
### Cochran Q post-hoc example
data(HayleySmith)
library(DescTools)
CochranQTest(Response ~ Practice | Student,
data = HayleySmith)
HayleySmith$Practice = factor(HayleySmith$Practice,
levels = c("MowHeight", "SoilTest",
"Clippings", "Irrigation"))
PT = pairwiseMcnemar(Response ~ Practice | Student,
data = HayleySmith,
test = "exact",
method = "fdr",
digits = 3)
PT
PT = PT$Pairwise
cldList(comparison = PT$Comparison,
p.value = PT$p.adjust,
threshold = 0.05)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.