NemenyiTest: Nemenyi Test for Multiple Comparisons (Non-Parametric)

View source: R/NemenyiTest.R

NemenyiTestR Documentation

Nemenyi Test for Multiple Comparisons (Non-Parametric)

Description

Performs the Nemenyi test after a significant Kruskal-Wallis or Friedman test. Based on the studentized range distribution applied to mean ranks.

Usage

NemenyiTest(formula, data, alpha = 0.05)

Arguments

formula

A formula of the form y ~ group.

data

A data frame containing the variables.

alpha

Significance level (default is 0.05).

Details

Advantages: - Easy to implement for equal-sized groups. - Conservative control of family-wise error rate.

Disadvantages: - Only valid with equal group sizes. - No p-values are directly calculated (based on critical differences only).

Value

An object of class "nemenyi" and "comparaciones", including:

  • Resultados: Data frame with group comparisons, rank differences, critical value, p-values, and significance codes.

  • Promedios: Mean ranks of each group.

  • Orden_Medias: Group names ordered from highest to lowest rank.

  • Metodo: Name of the method ("Nemenyi (no paramétrico)").

References

Nemenyi, P. (1963). Distribution-free Multiple Comparisons.

Examples

set.seed(123)
datos <- data.frame(
 grupo = rep(c("A", "B", "C", "D"), each = 10),
 medida = c(
   rnorm(10, mean = 10),
   rnorm(10, mean = 12),
   rnorm(10, mean = 15),
   rnorm(10, mean = 11)
 )
)
table(datos$grupo)
#> A  B  C  D
#>10 10 10 10
# Aplicar el test de Nemenyi
resultado <- NemenyiTest(medida ~ grupo, data = datos)
# Ver los resultados
summary(resultado)
# O simplemente
resultado$Resultados
# Ver orden de medias (rangos)
resultado$Orden_Medias




Analitica documentation built on June 14, 2025, 9:07 a.m.