Skip to contents

The Nemenyi test: all pairwise comparisons of the treatments following a Friedman repeated-measures test (friedmanTest), from the within-block mean ranks and the studentized-range distribution with single-step control of the family-wise error rate. It is the repeated-measures counterpart of Tukey's HSD (tukeyHSD) and Dunn's test (dunnTest). The statistics and p-values reproduce base R's Nemenyi formula, the PMCMRplus package and scikit_posthocs.posthoc_nemenyi_friedman to machine precision.

Usage

nemenyiTest(x)

Arguments

x

A blocks-by-treatments numeric matrix (rows = subjects/blocks, columns = conditions/treatments); rows with any missing value are dropped.

Value

A data frame with one row per pair: comparison, statistic and p_adj, carrying k (treatments) and n (complete blocks) as attributes.

Examples

m <- matrix(rnorm(40) + rep(c(0, 0.5, 1, 1.5), each = 10), nrow = 10)
colnames(m) <- c("a", "b", "c", "d"); nemenyiTest(m)
#>    comparison statistic       p_adj
#> b      b vs a 1.2124356 0.618912324
#> c      c vs a 3.1176915 0.009856376
#> c1     c vs b 1.9052559 0.225740880
#> d      d vs a 2.5980762 0.046267656
#> d1     d vs b 1.3856406 0.508353152
#> d2     d vs c 0.5196152 0.954411343