Robust t-test in R for two independent groups

Arndt Regorz, Dipl. Kfm. & M.Sc. Psychology, 04/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 t-test 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_ttest)
boxplot(DV ~ Group)
detach(data_ttest)

# Student's t-Test
attach(data_ttest)
t.test(DV~Group, var.equal=TRUE)
detach(data_ttest)

# Welch t-Test
attach(data_ttest)
t.test(DV~Group)
detach(data_ttest)

# Wilcoxon Rank Sum test (Mann-Whitney U-Test)
attach(data_ttest)
wilcox.test(DV~Group)
detach(data_ttest)

# Modern robust t-Tests

library(WRS2)

# Yuen's test
yuen(DV~Group, data=data_ttest)
yuen(DV~Group, data=data_ttest, tr = 0.1)

# Yuen's test bootstrapped
yuenbt(DV~Group, data=data_ttest, nboot=5000)