If two data samples come from different groups and the samples do not affect each other, they are independent. Using the Mann-whitney-wilcoxon test, we can determine if the population distribution is the same without assuming that they follow the normal distribution.
Cases
In the Data frame column of the dataset Mtcars mpg, there are a variety of gasoline mileage data for 1974 American cars.
> Mtcars $ mpg
[1] 21.0 21.0 22.8 21.4 18.7 ...
Also, another data column in the Mtcars named AM indicates the transport type of the car model (0 = automatic, 1 = manual). In other words, it is the distinguishing factor of the transport type.
> Mtcars $ am
[1] 1 1 1 0 0 0 0 0 ...
In particular, the gasoline mileage data for manual and automatic transmissions is independent.
Problem
If there is no assumption that the data has a normal distribution, then determine if the gasoline mileage data for manual and automatic transmissions in Mtcars has the same data distribution. 05 significant level.
Solution
The 0 hypothesis is that the gasoline mileage data for manual and automatic transmissions is the same for the population. To verify this hypothesis, we use the Wilcox.test function to compare independent samples. Since the P-value proves to be 0.001817 and less than. 05 of the significant level, we reject the 0 hypothesis.
> wilcox.test(mpg~am,data = mtcars)
Wilcoxon rank and test and continuity correction
Data: MPG AM AM
W = 42,p-value = 0.001871
Alternative hypothesis: True position offset not equal to 0
Warning message:
In Wilcox.test.default (x = C (21.4,18.7,18.1,14.3,24.4,22.8,:
The exact p-to-value relationship that cannot be calculated
Reply
At the significant level of. 05, we conclude that the gasoline mileage data for manual and automatic transmissions in the Mtcar are not the same group.
How to perform two sets of independent sample rank and test in R language 2