Related Articles

Related Articles

Kruskal Wallis Test
  • Last Updated : 26 Nov, 2020

Kruskal Wallis Test: It is a nonparametric test. It is sometimes referred to as One-Way ANOVA on ranks. It is a nonparametric alternative to One-Way ANOVA. It is an extension of the Man-Whitney Test to situations where more than two levels/populations are involved. This test falls under the family of Rank Sum tests. It depends on the ranks of the sample observations.

Non-Parametric Test:  It is a test which does not follow normal distribution.

Elements of a Kruskal Wallis Test

  • One independent variable with two or more levels. This independent variable is Categorical.
  • One dependent variable which can be in Ordinal, Interval or Ratio level of measurement.

Assumptions of Kruskal Wallis Test

  • Independence of Observations – Each observation can belong to only one level.
  • No assumption of normality.
  • Additional Assumption – The distributions of the dependent variable for all levels of the independent variable must have similar shapes. We can male use of Histograms or Boxplots to determine if the distributions have similar shapes. If this assumption is met it allows you to interpret the results of the Kruskal Wallis Test in terms of medians and not just mean ranks.

Null Hypothesis of Kruskal Wallis Test



The Kruskal Wallis Test has one Null Hypothesis i.e. – The distributions are Equal.

H Statistics of Kruskal Wallis Test

H=\left[\frac{12}{n(n+1)} \sum \frac{R_{i}^{2}}{n_{i}}\right]-3(n+1)

ni = number of items in sample i
Ri = sum of ranks of all items in sample i
K = total number of samples
n = n1 + n2 + ...... +nK ; Total number of observations in all samples.

Steps to perform Kruskal Wallis Test

Let us take an example to understand how to perform this test.

Example:- The score of a sample of 20 students in their university examination are arranged according to the method used in their training : 1) Video Lectures 2) Books and Articles 3) Class Room Training. Evaluate the Effectiveness of these training methods at 0.10 level of significance.

Video Lecture Books and Articles Class Room Training
76 80 70
90 80 85
84 67 52
95 59 93
57 91 86
72 94 79
  68 80

Step 1: Identify Independent and Dependent variables

Here,
Independent variable – method of training. It has three levels.
Dependent variable – examination scores.



Step 2: State the Hypothesis

H0 = The mean examination scores of students trained by each of the three methods are equal. u1=u2=u3.

H1 = At least one of the mean examination scores is not equal.

Step 3: Sort the data for all groups in ascending order and allot them ranks. If more than one entry has the same score then take the average of the ranks and allot the same rank to each of those entries.

Rank  Score Training Method Rank  Score Training Method
1 52 CR 11 80 BA
2 57 VL 11 80 CR
3 59 BA 13 84 VL
4 67 BA 14 85 CR
5 68 BA 15 86 CR
6 70 CR 16 90 VL
7 72 VL 17 91 BA
8 76 VL 18 93 CR
9 79 CR 19 94 BA
11 80 BA 20 95 VL

In this the score 80 had three ranks 10, 11 and 12. So we took the average of these ranks which was 11.

Step 4: Arrange back according to the levels an calculate the sum of ranks for each level.

Video Lecture  Rank Books and Articles Rank Class Room Training Rank
57 2 59 3 52 1
72 7 67 4 70 6
76 8 68 5 79 9
84 13 80 11 80 11
90 16 80 11 85 14
95 20 91 17 86 15
    94 19 93 18
  ∑=66   ∑=70   ∑=74

Step 5: Calculate H Statistics

H=\frac{12}{20(20+1)}\left[\frac{66^{2}}{6}+\frac{70^{2}}{7}+\frac{74^{2}}{7}\right]-3(20+1)

H = 0.0938

Step 6: Find the critical chi-square value



  • The chi-square distribution can be used when all the sample sizes are at least 5.

Degree of freedom = K-1 => 3-1=2 
Alpha = 0.10

Use this chi-square table to find the value.

X2 = 4.605

Step 7: Compare H value and Critical Chi- Square value

  • If H calc < X2 ; Accept the Null Hypothesis
  • If H calc > X2 ; Reject the Null Hypothesis

Here, 0.0938 < 4.605.

Since, Hcalc < X2 . We accept the Null Hypothesis. We can say that there is no difference in the result obtained by using the three training methods.

This is all about the Kruskal Wallis Test. For any queries do leave a comment down below.

machine-learning

My Personal Notes arrow_drop_up
Recommended Articles
Page :