In the previous article, we introduced the method of comparing two and multiple groups of normally distributed data. In this article, what we are going to explain is for Statistical Methods for Testing the Differences of Unusually Distributed Data , Which is the "rank sum test." This article will focus on the following: independent sample rank sum test, single sample rank sum test and paired sample rank sum test.
Basic concepts of rank sum test
The rank sum test is a non-parametric test. The non-parametric test does not consider the parameters of the population and the distribution type of the population, but performs a hypothesis test on the distribution and location of the population represented by the sample.
The basic concept of the rank sum test is to perform the rank first, and then use the rank to replace the original data to perform the test. Based on the rank test, whether the average rank of each group is equal or not, if the average rank of each group is not equal after the test, it can be inferred that the distribution of the data is different.
This article mainly uses two materials to explain, one is BMI data (Figure 1), and the other is IgA data (Figure 2).

Figure 1 BMI data

Figure 2 IgA data
Independent sample rank sum test
There are two main methods for the rank sum test of independent samples:
- Wilcoxon rank sum test for comparison between two groups
- Kruskal-Wallis rank sum test for multi-group comparison
See < A magical JMP function table to realize the comparison of all data between groups >. The relationship between the two is somewhat similar to the relationship between t test and variance analysis.
It should be noted here that the Wilcoxon rank sum test or the Kruskal-Wallis rank sum test can be used for the comparison between the two groups; the Kruskal-Wallis rank sum test can only be used for the comparison of multiple groups. The operation of the rank sum test of two and multiple groups of independent samples is the same. In order to avoid repetitive introduction, this article only introduces the rank sum test of multiple sets of samples as an example.
In the data (Figure 1), suppose we want to compare whether there is a difference in the BMI of patients with different cardiac function classifications. Therefore, the Jiang heart function classification is divided into four levels, which are represented by 1-4 respectively. BMI is an abnormal distribution, so consider Kruskal-Wallis Rank sum test , The analysis process is as follows:
First, click JMP "Analyze" → "Fit Y with X" (Figure 3 below) to enter the interface for comparing differences between groups.

Figure 3 Independent sample rank sum test operation-function table selection
In this example, BMI is the result, and the cardiac function classification is grouped. Therefore, in the dialog box, put the BMI into "Y, response" and the "cardiac function classification" into "X, factor" (Figure 4).

Figure 4 Independent sample rank sum test operation-variable selection
After entering the interface of the analysis results, click the red triangle button above the single factor analysis of "Cardiac Function Classification-BMI", and select " Non-parametric → Wilcoxon Verification "(Figure 5).

Figure 5 Independent sample rank sum test operation-method selection
The output result is shown in Figure 6. The result has two main parts:
- The first part is Data description , Give the number of cases, rank sum, average rank and other information of each group. From the results of the average score, it can be seen that patients with a cardiac function class 4 have the highest BMI.
- The second part is Statistical verification results , Gives the result of Kruskal-Wallis rank sum test. It shows that there is a statistically significant difference in BMI of patients with different cardiac function grades (Chi-square=10.4306, P=0.0152).
Intimate reminder: The statistics given here are chi-square, because the results of the Kruskal-Wallis rank sum test obey the chi-square distribution, not a chi-square test, so don’t confuse it.

Figure 6 Independent sample rank sum test operation-test results
Note: If the rank sum test of two sets of samples is performed, two results of the Wilcoxon rank sum check sum Kruskal-Wallis rank sum test will be given at the same time, and the results of the two tests are consistent. Kruskal-Wallis The results of the rank sum test show statistical differences. Usually we are still interested in which two groups are different, which requires pairwise comparisons between groups.
Next, we click the red triangle button next to the single factor analysis of "Cardiac Function Classification-BMI", and select "Non-parameters" → "Non-parametric Multiple Comparisons" → "Perform Steel-Dwass Tests on All Pairs" in the drop-down menu. The operation is shown in Figure 7.

Figure 7 Independent sample rank sum test operation-pairwise comparison operation
The output results are shown in Figure 8. The pairwise comparison results show that the levels 2 and 4 (Z=3.089, P=0.0108) in the cardiac function classification; the differences between levels 3 and 4 (Z=3.057, P=0.0120) are statistically significant .

Figure 8 Independent sample rank sum test operation-pairwise comparison test results
The analysis results of this case show that the difference in BMI of patients with different cardiac function grades is statistically significant. The pairwise comparison results showed that the difference between cardiac function classification levels 2 and 4; 3 and 4 was statistically significant.
One-sample rank sum test
Based on the data in Figure 1, explore whether there is a difference between the patient's BMI and the normal value of healthy people. Assuming that the normal value of BMI is 19 and the BMI is abnormally distributed, a single-sample rank sum test is performed.
In previous articles, we have explained to you how to perform a single-sample t test for normal distribution data. However, in reality, the data may not always present a normal distribution. When we get abnormal distribution data, how should we analyze it? ?
The first four steps of the single-sample rank sum test are the same as the single-sample t test:
①Select "Analysis" → "Distribution" in the JMP menu;
②In the pop-up dialog box, put BMI into "Y, row";
③Click the red triangle button on the left side of BMI in the result interface, and select "Verified Mean Value" in the drop-down menu;
④Fill in 19 in the specified hypothesis mean value in the pop-up dialog box.
The above steps are detailed in " Three common methods of t-test in a literature society ".
After completing the above steps, click OK to output the single-sample t test result.
If you want to output the result of the single-sample rank sum test, continue to check "Wilcoxon Signed Rank" in the dialog box (Figure 9).

Figure 9 Single-sample rank sum test operation-method selection
The result is shown in Figure 10. The result includes not only the result of the t test, but also the result of the rank sum test (the result of the "signed rank" part). The results showed that the difference was statistically significant (verification statistics=3114.500, P<0.0001).

Figure 10 Single-sample rank sum verification operation-verification result
Rank sum test of paired samples
This case uses the data in Figure 2 to analyze whether there is a difference in IgA before and after chemotherapy. In previous articles, we have explained the operating steps of the pairing t test for everyone.
The first two steps of the paired rank sum test are the same as those of the paired t test. The operation flow is:
①Select JMP menu "Analysis" → "Professional Modeling" → "Matching";
②In the pop-up dialog box "Y, paired response", first IgA before radiotherapy and chemotherapy, and then IgA after radiotherapy and chemotherapy.
For the above steps, please refer to "Three Common Methods of T Verification in a Literature Association".
After completing the above steps, click the red triangle button next to "Matching" in the result interface, and select "Wilcoxon Signed Rank" from the drop-down menu to obtain the result of the paired rank sum test (Figure 11).

Figure 11 Paired rank sum test operation-method selection
The results are shown in Figure 12, there is a statistically significant difference in IgA between patients before and after chemotherapy (S=-2523.0, p<0.0001).

Figure 12 Paired rank sum test operation-test results
in conclusion
Under normal circumstances, the data compared between groups is obviously skewed, and we will consider using the rank sum test instead of the t test or analysis of variance (ANOVA). Many people may have a certain misunderstanding about the rank sum test. They always feel that the rank sum test is like a "spare tire." In fact, the efficiency of the rank sum test is not low.
If the data is normally distributed, the test efficiency of the rank sum test is not much worse than the t test, analysis of variance, etc.; if The data presents a skewed distribution, and the efficiency of the rank sum test is much higher than t Check sum and variance analysis . Therefore, it is recommended that you must consider the distribution of data in practice, and then choose a reasonable and effective analysis method.
original: Dry goods | Ideas and analysis of rank sum test and its pairwise comparison
Recommended reading:
Analysis of Variation (ANOVA) and Pairwise Comparison: Thinking Thread and Analysis Method
Perform normality test and homogeneity test of variance in JMP
Introduction to Design of Experiments (DOE): Classic Screening Design and Full Factorial Design