pairwiseMedianTest.RdConducts pairwise Mood's median tests across groups.
pairwiseMedianTest(
formula = NULL,
data = NULL,
x = NULL,
g = NULL,
digits = 4,
method = "fdr",
...
)A formula indicating the measurement variable and the grouping variable. e.g. y ~ group.
The data frame to use.
The response variable as a vector.
The grouping variable as a vector.
The number of significant digits to round output.
The p-value adjustment method to use for multiple tests.
See stats::p.adjust.
Additional arguments passed to
coin::median_test.
A dataframe of the groups being compared, the p-values, and the adjusted p-values.
The input should include either formula and data;
or x, and g.
Mood's median test compares medians among two or more groups. See https://rcompanion.org/handbook/F_09.html for further discussion of this test.
The pairwiseMedianTest function
can be used as a post-hoc method following an omnibus Mood's
median test. It passes the data for pairwise groups to
coin::median_test.
The output can be converted to a compact letter display, as in the example.
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.
data(PoohPiglet)
PoohPiglet$Speaker = factor(PoohPiglet$Speaker,
levels = c("Pooh", "Tigger", "Piglet"))
PT = pairwiseMedianTest(Likert ~ Speaker,
data = PoohPiglet,
exact = NULL,
method = "fdr")
PT
#> Comparison p.value p.adjust
#> 1 Pooh - Tigger = 0 0.6147 0.614700
#> 2 Pooh - Piglet = 0 0.0004883 0.001465
#> 3 Tigger - Piglet = 0 0.002165 0.003247
cldList(comparison = PT$Comparison,
p.value = PT$p.adjust,
threshold = 0.05)
#> Group Letter MonoLetter
#> 1 Pooh a a
#> 2 Tigger a a
#> 3 Piglet b b