GHTest: Games-Howell Post Hoc Test v.2.2.0

View source: R/GamesHowellTest.R

GHTestR Documentation

Games-Howell Post Hoc Test v.2.2.0

Description

Performs the Games-Howell test for pairwise comparisons after ANOVA, without assuming equal variances or sample sizes. It is suitable when Levene or Bartlett test indicates heterogeneity of variances.

Usage

GHTest(modelo, comparar = NULL, alpha = 0.05)

Arguments

modelo

An aov or lm object (full model: includes blocks, factors, etc.).

comparar

Character vector with the name(s) of the factor(s) to compare: - One name: main effect (e.g., "treatment" or "A") - Several names: interaction (e.g., c("A","B") for A:B) If omitted, it uses the first factor in modelo$xlevels.

alpha

Significance level (default is 0.05).

Details

Advantages: - Excellent for heteroscedastic data. - Controls Type I error across unequal group sizes.

Disadvantages: - Slightly conservative in small samples. - More complex to compute than Tukey.

Value

An object of class "gameshowell" and "comparaciones", which contains:

  • Resultados: A data frame with pairwise comparisons, including: Comparacion, Diferencia, t_value, gl, p_value, and Significancia.

  • Promedios: A named numeric vector of group means as defined by comparar.

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

  • Metodo: A character string indicating the method used ("Games-Howell").

  • Termino: The term being compared (e.g., "A", "B", or "A:B").

References

Games, P. A., & Howell, J. F. (1976). "Pairwise Multiple Comparison Procedures with Unequal N's and/or Variances: A Monte Carlo Study". Journal of Educational Statistics, 1(2), 113–125. <https://doi.org/10.1002/j.2162-6057.1976.tb00211.x>

Examples

data(d_e, package = "Analitica")
mod <- aov(Sueldo_actual ~ as.factor(labor), data = d_e)
# Comparación sobre el primer factor del modelo
resultado <- GHTest(mod)
summary(resultado)
plot(resultado)

# Con bloques, comparando solo el factor de interés
mod2 <- aov(Sueldo_actual ~ as.factor(labor) + Sexo, data = d_e)
res2 <- GHTest(mod2, comparar = "as.factor(labor)")
summary(res2)
plot(res2)

# Modelo con interacción
mod3 <- aov(Sueldo_actual ~ as.factor(labor) * Sexo, data = d_e)
# efecto principal
resA <- GHTest(mod3, comparar = "as.factor(labor)")
# interacción
resAB <- GHTest(mod3, comparar = c("as.factor(labor)", "Sexo"))
summary(resAB)
plot(resAB)

Analitica documentation built on Dec. 3, 2025, 9:07 a.m.