DuncanTest: Duncan Multiple Range Test (DMRT) v2.0

View source: R/DuncanTest.R

DuncanTestR Documentation

Duncan Multiple Range Test (DMRT) v2.0

Description

Performs the Duncan test for pairwise comparisons after an ANOVA. This method is more liberal than Tukey's HSD, using a stepwise approach with critical values from the studentized range distribution.

Usage

DuncanTest(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 0.05).

Details

Advantages: - High power for detecting differences. - Simple to interpret and implement.

Disadvantages: - Inflates Type I error rate. - Not recommended for confirmatory research.

Value

An object of class "duncan" and "comparaciones" containing:

  • Resultados: a data.frame with columns Comparacion, Diferencia, SE, t_value, p_value (unadjusted), p_ajustada (duncan), Valor_Critico (critical difference), and Significancia.

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

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

  • Metodo: "Duncan t-test".

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

  • MSerror, df_error, N: useful for plots with error bars.

References

Duncan, D. B. (1955). "Multiple range and multiple F tests." Biometrics, 11(1), 1-42.

Examples


# DCA
data(d_e, package = "Analitica")
mod1 <- aov(Sueldo_actual ~ as.factor(labor), data = d_e)
resultado <- DuncanTest(mod1)
summary(resultado)
plot(resultado)

# DBA
mod2 <- aov(Sueldo_actual ~ as.factor(labor) + Sexo, data = d_e)
res <- DuncanTest(mod2, comparar = "as.factor(labor)")
summary(res); plot(res)

# DFactorial
mod3 <- aov(Sueldo_actual ~as.factor(labor) * Sexo, data = d_e)
resAB <- DuncanTest(mod3, comparar = c("as.factor(labor)","Sexo"))  # celdas A:B
summary(resAB, n = Inf); plot(resAB, horizontal = TRUE)


Analitica documentation built on Nov. 5, 2025, 5:13 p.m.