Learn R Programming

Analitica (version 1.8.5)

TukeyTest: Tukey HSD Test for Multiple Comparisons

Description

Performs Tukey's Honest Significant Difference (HSD) test for all pairwise comparisons after fitting an ANOVA model. This post hoc method uses the studentized range distribution and is appropriate when variances are equal across groups and observations are independent.

Usage

TukeyTest(modelo, alpha = 0.05)

Value

An object of class "tukey" and "comparaciones", containing:

  • Resultados: A data frame of pairwise comparisons with mean differences, critical value, p-value, and significance level.

  • Promedios: A named numeric vector of group means.

  • Orden_Medias: A character vector with group names ordered from highest to lowest mean.

  • Metodo: A character string indicating the method used ("Tukey").

Arguments

modelo

An object of class aov or lm representing an ANOVA model.

alpha

Significance level (default is 0.05).

Details

Tukey's test controls the family-wise error rate and is widely used when group comparisons have not been planned in advance.

Advantages: - Strong control of Type I error rate. - Ideal for balanced designs with equal variances.

Disadvantages: - Assumes equal variances and sample sizes. - Less powerful with heteroscedasticity.

References

Tukey, J. W. (1949). "Comparing individual means in the analysis of variance." Biometrics, 5(2), 99–114. <https://doi.org/10.2307/3001913>

Examples

Run this code
data(d_e, package = "Analitica")
mod <- aov(Sueldo_actual ~ as.factor(labor), data = d_e)
resultado <- TukeyTest(mod)
summary(resultado)
plot(resultado)

Run the code above in your browser using DataLab