The Kruskal-Wallis Test


KRUSKAL.83p
KRUSKAL.86p
kruskal.89p

The Kruskal-Wallis test is a nonparametric method of testing the hypothesis that several populations have the same continuous distribution versus the alternative that measurements tend to be higher in one or more of the populations.

To apply the test, we obtain independent random samples of sizes n1, n2, . . . , nm from m populations. Assume that there are N observations in all. We rank all N observations and let Ri be the sum of the ranks of the ni observations in the ith sample. The Kruskal-Wallace statistic is

H = [12 / (N (N + 1)) ] * Sum[ Ri ^2 / ni , i, 1, m ] - 3(N + 1).

When the sample sizes are large and all m populations have the same continuous distribution, then H has an approximate chi-square distribution with m - 1 degrees of freedom.

When H is large, creating a small right-tail probability (p-value), then we reject the null hypothesis that all populations have the same distribution.



Using the KRUSKAL Program

To execute the KRUSKAL program on the TI-83, we must use the MATRX EDIT screen to enter the data into matrix [A] that is defined to have m columns. The number of rows should be the maximum of the sample sizes. Fill out the last entries in the other columns with zeros. Next, enter the sample sizes into matrix [B] having dimensions 1 x m.

On the TI-86 use matrices called A and B. On the TI-89 use matrices called a and b in the Main folder.

The program displays the test statistic and P-value. Under list L5 on the TI-83 (fStat on the TI-86, or in c3 in the current list on the TI-89: Press APPS, then 6, then 1), the sums of the ranks from each population are listed.



Example. Below are the combined SAT scores for three GPA ranges from random samples of high school seniors. Use the data to test the hypothesis that there is no difference SAT score distribution among the three groups.

High School GPA
3.51 - 4.0
3.0 - 3.50
0 - 2.99
1220
1270
1220
1160
1200
850
950
970
880
1070
720
920
1110
1070
910
1150
860
1260
1440
980
830
1280
800
810
1020
900
820
1080
1330
1170
1120
1140
810
1210
870
1040
1030
1010
960
1020
760
920
1400
830
1260
1170
910
1060
1350
1230
1090
1070
1110
1050
1320
970
880
1200
1090
750
1070
1300
960
1240
1090
970


Solution. First, we enter the data into a 23 x 3 matrix [A] (A or a) and the successive sample sizes 22, 21, and 23 into the 1 x 3 matrix [B] (B or b). Then we call up and execute the KRUSKAL program to obtain a test statistic of14.2463 and a P-value of 0.000806. Based on the low P-value, we can reject the claim that SAT scores have the same distribution among these three grade point average groups.

Under list L5 on the TI-83 (fStat on the TI-86, or in c3 in the current list TI-89: Press APPS, then 6, then 1), we see that the sums of the ranks from the three groups are 1008.5, 623.5, and 579. If the SAT scores had the same distribution among these three GPA groups, then there would be only 0.000806 probability of the sums of the ranks being so disparate.

(Note: The conclusion does not mean that all three distributions are distinct. It simply means that at least one is different from the other two. It might be that one pair may have the same distribution. But pairs of groups can now be tested for having the same distribution using the sign test or the rank sum test.)



Exercise

Here are raw sample data on the women's heights in inches as broken down by various age groups. Use the Kruskal-Wallis procedure to test the null hypothesis that heights have the same distribution for each age group.

Age
20-29
63.75
68.25
62.25
67.25
70.75
65.75
68.5
63.75
64
65.75
30-39
64.75
67.5
68.25
69
64.75
66.5
64
68.25
65.5
40-49
68.5
69
66
65.5
66.5
67.75
70.5
64.25
65.25
64.5
69.5
66
50-59
64.5
66.25
66
67.5
65.25
64.75
67.5
69.75
60
65.5



Solution

1. First enter the heights into the 12 x 4 matrix [A] (A or a). Be sure to enter the populations as columns within the matrix. Fill out the first, second, and fourth columns with zeros. Then enter the sample sizes 10, 9, 12, 10 into the 1 x 4 matrix [B] (B or b).

After entering the data into the appropriate matrices and executing the KRUSKAL program, we obtain a test statistic of 1.64718 and a P-value of 0.64874. Based on the high P-value, we do not have evidence to reject the claim that heights have the same distribution among these four age groups.

Under list L5 on the TI-83 (fStat on the TI-86, or in c3 in the current list on the TI-89), we see that the sums of the ranks from the four groups are 185, 196.5, 290.5, and 189. These are not significant variations to warrant rejecting the null hypothesis.



Return to Table of Contents.