Checking assumptions of parametric tests
Check normality of multiple groups in 1 line of code
The previous video showed how to check normality of each group separately. It means you have to repeat shapiro.test() for each group in the data set. To check all groups simultaneously you can use apply():
Make a QQ plot of the data
For medium-sized or large data sets you can also make a QQ-plot to check normality of the data. Ggplot2 has layers to create a QQ-plot:
ggplot(data,aes(sample=dataset1)) + stat_qq() + stat_qq_line()
This code assumes that the data are in a data frame called data and that the two groups make up separate columns in data: dataset1 and dataset2.
The code produces a QQ-plot that compares the distribution of dataset1 to a standard normal distribution: if the points follow the red diagonal then the distribution of the dataset strongly resembles a normal distribution.
Check if groups have equal spreads
Parametric tests assume that the groups that you compare have equal spreads.