View source: R/BonferroniTest.R
| BonferroniTest | R Documentation |
Performs pairwise t-tests with Bonferroni adjustment for multiple comparisons. This method controls the family-wise error rate by dividing the alpha level by the number of comparisons.
BonferroniTest(modelo, comparar = NULL, alpha = 0.05)
modelo |
An |
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., |
alpha |
Significance level (default 0.05). |
Advantages: - Very simple and easy to implement. - Strong control of Type I error. - Applicable to any set of independent comparisons.
Disadvantages: - Highly conservative, especially with many groups. - Can lead to low statistical power (increased Type II error). - Does not adjust test statistics, only p-values.
An object of class "bonferroni" and "comparaciones" containing:
Resultados: a data.frame with columns Comparacion, Diferencia, SE, t_value,
p_value (unadjusted), p_ajustada (Bonferroni), 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: "Bonferroni-adjusted t-test".
Termino: the term being compared (e.g., "A", "B", or "A:B").
MSerror, df_error, N: useful for plots with error bars.
Dunn, O. J. (1964). Multiple Comparisons Using Rank Sums. Technometrics, 6(3), 241–252. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00401706.1964.10490181")}
Wilcoxon, F. (1945). Individual Comparisons by Ranking Methods. Biometrics Bulletin, 1(6), 80–83. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/3001968")}
#DCA
data(d_e, package = "Analitica")
mod1 <- aov(Sueldo_actual ~ as.factor(labor), data = d_e)
summary(mod1)
resultado <- BonferroniTest(mod1)
summary(resultado)
DBA: y ~ tratamiento + bloque
mod2 <- aov(Sueldo_actual ~ as.factor(labor) + Sexo, data = d_e)
res <- BonferroniTest(mod2, comparar = "as.factor(labor)")
summary(res); plot(res)
# DFactorial: y ~ A * B
mod2 <- aov(Sueldo_actual ~ as.factor(labor) * Sexo, data = d_e)
resAB <- BonferroniTest(mod2, comparar = c("as.factor(labor)","Sexo")) # compara celdas A:B
summary(resAB, n = Inf); plot(resAB, horizontal = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.