T3Test: Dunnett's T3 Post Hoc Test v2.2.0

View source: R/T3Test.R

T3TestR Documentation

Dunnett's T3 Post Hoc Test v2.2.0

Description

Performs Dunnett's T3 test for pairwise comparisons after an ANOVA model. This test is recommended when group variances are unequal and sample sizes differ. It is based on the studentized range distribution and provides conservative control over Type I error without assuming homoscedasticity.

Usage

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

Arguments

modelo

An object of class aov or lm (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: - More powerful than T2 when group sizes are small. - Adjusted for unequal variances.

Disadvantages: - Complex critical value estimation. - Less frequently used and harder to find in software.

Value

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

  • Resultados: A data frame with pairwise comparisons, mean differences, q_value, gl, p_value, and significance indicators.

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

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

  • Metodo: A character string with the test name ("Dunnett T3").

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

References

Dunnett, C. W. (1980). "Pairwise multiple comparisons in the unequal variance case." Journal of the American Statistical Association, 75(372), 796–800. <https://doi.org/10.1080/01621459.1980.10477558>

Examples

data(d_e, package = "Analitica")
mod <- aov(Sueldo_actual ~ as.factor(labor), data = d_e)
resultado <- T3Test(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 <- T3Test(mod2, comparar = "as.factor(labor)")
summary(res2)
plot(res2)

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


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