ScheffeTest: Scheffe Test for Multiple Comparisons v2.0

View source: R/ScheffeTest.R

ScheffeTestR Documentation

Scheffe Test for Multiple Comparisons v2.0

Description

Performs Scheffe's post hoc test after fitting an ANOVA model. This test compares all possible pairs of group means, using a critical value based on the F-distribution.

Usage

ScheffeTest(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

The Scheffe test is a conservative method, making it harder to detect significant differences, but reducing the likelihood of Type I errors (false positives). It is especially appropriate when the comparisons were not pre-planned and the number of contrasts is large.

Assumptions: normally distributed residuals and homogeneity of variances.

Advantages: - Very robust to violations of assumptions. - Suitable for complex comparisons, not just pairwise.

Disadvantages: - Very conservative; reduced power. - Not ideal for detecting small differences.

Value

Objeto de clase "scheffe" and "comparaciones" with:

  • Resultados: data.frame with Comparacion, Diferencia, SE2 (= MSerror*(1/n_i+1/n_j)), F_obs, Valor_Critico, p_value, Significancia.

  • Promedios, Orden_Medias, Metodo="Scheffe", Termino.

  • MSerror, df_error, N (utiles para plot.comparaciones()).

References

Scheffe, H. (1953). "A method for judging all contrasts in the analysis of variance." Biometrika, 40(1/2), 87–104. <https://doi.org/10.1093/biomet/40.1-2.87>

Examples

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

# RCBD
mod <- aov(Sueldo_actual ~ as.factor(labor) + Sexo, data = d_e)
res <- ScheffeTest(mod, comparar = "as.factor(labor)")
summary(res); plot(res)                      # plot usara p_value

# Factorial
mod2 <- aov(Sueldo_actual ~ as.factor(labor) * Sexo, data = d_e)
resAB <- ScheffeTest(mod2, comparar = c("as.factor(labor)","Sexo"))
summary(resAB, n = Inf); plot(resAB, horizontal = TRUE)



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