Learn R Programming

rcompanion (version 1.13.2)

pairwiseMedianMatrix: Pairwise Mood's median tests with matrix output

Description

Conducts pairwise Mood's median tests across groups.

Usage

pairwiseMedianMatrix(formula = NULL, data = NULL, x = NULL, g = NULL,
  exact = NULL, method = "fdr", ...)

Arguments

formula

A formula indicating the measurement variable and the grouping variable. e.g. y ~ group.

data

The data frame to use.

x

The response variable as a vector.

g

The grouping variable as a vector.

exact

If TRUE, then asks the mood.medtest function to conduct an exact test. If NULL, then uses an exact test if the number of values is less than 200. See mood.medtest.

method

The p-value adjustment method to use for multiple tests. See p.adjust.

...

Additional arguments passed to mood.medtest.

Value

A list consisting of: a matrix of p-values; the p-value adjustment method; a matrix of adjusted p-values.

Details

The input should include either formula and data; or x, and g.

Mood's median test compares medians among two or more groups. See http://rcompanion.org/handbook/F_09.html for futher discussion of this test.

The pairwiseMedianMatrix function can be used as a post-hoc method following an omnibus Mood's median test. The matrix output can be converted to a compact letter display.

References

http://rcompanion.org/handbook/F_09.html

See Also

pairwiseMedianTest

Examples

Run this code
# NOT RUN {
data(PoohPiglet)
PoohPiglet$Speaker = factor(PoohPiglet$Speaker,
                          levels = c("Pooh", "Tigger", "Piglet"))
PT = pairwiseMedianMatrix(Likert ~ Speaker,
                          data   = PoohPiglet,
                          exact  = NULL,
                          method = "fdr")$Adjusted
PT                           
library(multcompView)
multcompLetters(PT,
                compare="<",
                threshold=0.05,
                Letters=letters)                    

# }

Run the code above in your browser using DataLab