14.4 When assumptions aren’t met
If the normal distribution assumption is violated, and you are unable to find a transformation that works (see the Checking assumptions and data transformations tutorial), then you can try a non-parametric test.
A tutorial on non-parametric tests is under development, but will not be deployed until 2023. Consult chapter 13 in the Whitlock & Schluter text, and this website for some R examples.
If the equal-variance assumption is violated for the 2-sample t-test, then you can set the “var.equal” argument to “FALSE” in the t.test
function, in which case the function implements a “Welch’s t-test”.
For instance, let’s pretend that the height data did not exhibit equal variance among left- and right- dominant eye students, here’s the appropriate code:
height.ttest.unequal.var <- students %>%
t.test(height_cm ~ Dominant_eye,
data = ., var.equal = FALSE, conf.level = 0.95)
height.ttest.unequal.var
##
## Welch Two Sample t-test
##
## data: height_cm by Dominant_eye
## t = 1.6919, df = 104.37, p-value = 0.09366
## alternative hypothesis: true difference in means between group Right and group Left is not equal to 0
## 95 percent confidence interval:
## -0.4778181 6.0318197
## sample estimates:
## mean in group Right mean in group Left
## 172.8368 170.0598