Nemenyi post-hoc test

Authors

Keith Musara

University Of Zimbabwe

Published

February 3, 2025

# Load necessary libraries
library(PMCMRplus)
library(scmamp)

Define your data matrix

y <- matrix(c(
  3.88, 5.64, 5.76, 4.25, 5.91, 4.33,
  30.58, 30.14, 16.92, 23.19, 26.74, 10.91,
  25.24, 33.52, 25.45, 18.85, 20.45, 26.67,
  4.44, 7.94, 4.04, 4.4, 4.23, 4.36,
  29.41, 30.72, 32.92, 28.23, 23.35, 12,
  38.87, 33.12, 39.15, 28.06, 38.23, 26.65
), nrow = 6, ncol = 6, dimnames = list(1:6, LETTERS[1:6]))

Perform the Nemenyi post-hoc test

(nemenyi_result <- nemenyiTest(y))

    Nemenyi test

data:  y
Critical difference = 3.2853, k = 6, df = 30
(matrixz<-nemenyi_result$diff.matrix)
             A          B          C          D         E        F
[1,] 0.0000000  2.5000000  2.8333333  0.3333333 3.1666667 4.166667
[2,] 2.5000000  0.0000000  0.3333333 -2.1666667 0.6666667 1.666667
[3,] 2.8333333  0.3333333  0.0000000 -2.5000000 0.3333333 1.333333
[4,] 0.3333333 -2.1666667 -2.5000000  0.0000000 2.8333333 3.833333
[5,] 3.1666667  0.6666667  0.3333333  2.8333333 0.0000000 1.000000
[6,] 4.1666667  1.6666667  1.3333333  3.8333333 1.0000000 0.000000

Generate Critical Difference Plot

scmamp::plotCD(matrixz, main = "Critical Difference Plot", xlab = "Treatments", ylab = "Mean Ranks")