Robust oneway ANOVA for three or more independent groups
Arndt Regorz, Dipl. Kfm. & M.Sc. Psychology, 31/05/2022
(Note: When you click on this video you are using a service offered by YouTube.)
Here is the R code for the Youtube tutorial about a robust ANOVA in R.
You will need the following R package, which must be installed once before use, e.g. install.packages("WRS2"):
- WRS2
R code
# Boxplot
attach(data_anova)
boxplot(DV ~ Group)
detach(data_anova)
# ANOVA
summary(aov(DV ~ Group, data = data_anova))
pairwise.t.test(data_anova$DV, data_anova$Group, p.adjust.method = "bonferroni")
# Kruskal-Wallis test
attach(data_anova)
kruskal.test(DV ~ Group)
pairwise.wilcox.test(DV, Group, p.adjust="bonferroni")
detach(data_anova)
# Modern robust ANOVA
library(WRS2)
# Robust ANOVA (heteroscedastic one-way ANOVA for trimmed means)
t1waybt(DV ~ Group, data = data_anova, nboot = 5000)
# Robust post hoc test (based on trimmed means)
mcppb20(DV ~ Group, data = data_anova, nboot = 5000)
# (please look at the CIs, not at the p-values!)
# Robust ANOVA with different trim fraction (in most cases not recommended)
t1waybt(DV ~ Group, data = data_anova, nboot = 5000, tr = 0.1)