Understanding the Wilcoxon Rank Sum and Signed Rank test
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.
Getting ready
Ensure that mtcars
has already been loaded into a data frame within an R session. As the wilcox.test
function is originated from the stats
package, make sure the library, stats
, is loaded.
How to do it...
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')) ...
Get R: Recipes for Analysis, Visualization and Machine Learning now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.