How to do it...

Perform the following steps:

  1. We first plot the data of mtcars with the boxplot function:
        > boxplot
(mtcars$mpg~mtcars$am,ylab='mpg',names=c('automatic','manual'))
The boxplot of mpg of automatic cars and manual transmission cars
  1. Next, we still perform a Wilcoxon Rank Sum test to validate whether the distribution of automatic transmission cars is identical to that of manual transmission cars:
        > wilcox.test(mpg ~ am, data=mtcars)
Output:
Wilcoxon rank sum test with continuity correction
data: mpg by am
W = 42, p-value = 0.001871
alternative hypothesis: true location shift is not equal to 0
Warning message:
In wilcox.test.default(x = c(21.4, 18.7, 18.1, 14.3, 24.4, 22.8, :
cannot compute exact p-value with ties
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset