The Wilcoxon Rank Sum and Signed Rank test (or Mann-Whitney-Wilcoxon) is a nonparametric test of the null hypothesis, which shows that the population distribution of two different groups are identical without assuming that the two groups are normally distributed. This recipe will show how to conduct the Wilcoxon Rank Sum and Signed Rank test in R.
Ensure that mtcars
has already been loaded into a DataFrame within an R session. As the wilcox.test
function is originated from the stats
package, make sure the library, stats
, is loaded.
Perform the following steps:
- We first plot the data of
mtcars
with theboxplot
function:
> boxplot (mtcars$mpg~mtcars$am,ylab='mpg',names=c('automatic','manual'))
The boxplot of mpg of automatic cars and manual transmission cars
- Next, we still perform a Wilcoxon Rank Sum test to validate whether the distribution of automatic transmission cars is identical to that...