Top Nav

Kruskal Wallis Test with SigmaXL

Kruskal–Wallis One-Way Analysis of Variance

The Kruskal Wallis one-way analysis of variance is a statistical hypothesis test to compare the medians among more than two groups.

  • Null Hypothesis (H0): η1 = η2 = … = ηk
  • Alternative Hypothesis (Ha): at least one of the medians is different from others.
    Where:
  • ηi is the median of population i
  • k is the number of groups of our interest.

It is an extension of Mann–Whitney test. While the Mann–Whitney test allows us to compare the samples of two populations, the Kruskal–Wallis test allows us to compare the samples of more than two populations.
One key difference between this test and the Mann–Whitney test is the robustness of the test when the populations are not identically shaped. If this is the case, there is a different test, called Mood’s median, which is more appropriate.

Kruskal Wallis One-Way Analysis of Variance: Assumptions

  • The sample data drawn from the populations of interest are unbiased and representative.
  • The data of k populations are continuous or ordinal when the spacing between adjacent values is not constant.
  • The k populations are independent to each other.
  • The Kruskal–Wallis test is robust for the non-normally distributed population.

How Kruskal Wallis One-Way ANOVA Works

The Kruskal–Wallis test works very similarly to the Mann–Whitney Test.
Step 1: Group the k samples from k populations (sample i is from population i) into one single data set and then sort the data in ascending order ranked from 1 to N, where N is the total number of observations across k groups.
Step 2: Add up the ranks for all the observations from sample i and call it ri, where i can be any integer between 1 and k.

Step 3: Calculate the test statistic
Where:

  • k is the number of groups
  • ni is the sample size of sample i
  • N is the total number of all the observations across k groups
  • rij is the rank (among all the observations) of observation j from group i.

Step 4: Make a decision of whether to reject the null hypothesis.

  • Null Hypothesis (H0): η1 = η2 =…= ηk
  • Alternative Hypothesis (Ha): at least one of the medians is different from others.

The test statistic follows chi-square distribution when the null hypothesis is true. If T is greater than  Kruskal Wallis SXL_00(the critical chi-square statistic), we reject the null and claim there is at least one median statistically different from other medians. If T is smaller than Kruskal Wallis SXL_00, we fail to reject the null and claim the medians of k groups are equal.

Use SigmaXL to Run a Kruskal Wallis One-Way ANOVA

Case study: We are interested in comparing customer satisfaction among three types of customers using a nonparametric (i.e. distribution-free) hypothesis test: Kruskal–Wallis one-way ANOVA.
Data File: “Kruskal–Wallis” tab in “Sample Data.xlsx”

Kruskal Wallis SXL_01
Fig 1.0 Kruskal-Wallis Test

  • Null Hypothesis (H0): η1 = η2 = η3
  • Alternative Hypothesis (Ha): at least one of the customer types has different overall satisfaction levels from the others.

Steps to run a Kruskal Wallis One-Way ANOVA in SigmaXL

  1. Select the entire range of data (both “Customer Type” and “Overall Satisfaction”
  2. Click SigmaXL -> Statistical Tools -> Nonparametric Tests -> Kruskal-Wallis Median Test

Kruskal Wallis SXL_02
Fig 1.1 SigmaXL > Statistical Tools > Nonparametric Tests > Kruskal-Wallis Median Test

  1. A new window named “Kruskal-Wallis” pops up with the selected range appearing in the box under “Please select your data”

Kruskal Wallis SXL_03
Fig 1.2 Kruskal Wallis data selection box

  1. Click “Next>>”
  2.  A new window named “Nonparametric ANOVA” appears

Kruskal Wallis SXL_04
Fig 1.3 Kruskal Wallis Nonparametric ANOVA variable selection box

  1. Select “Overall Satisfaction” as the “Numeric Data Variables (Y)”
  2. Select “Customer Type” as the “Group Category (X)”

Kruskal Wallis SXL_05
Fig 1.4 Kruskal Wallis Nonparametric ANOVA variable selection box with selected variables

  1. Click “OK”
  2. The Kruskal-Wallis test results appear in the newly generated tab “Kruskal-Wallis (1)”

Kruskal Wallis SXL_06
Fig 1.5 Kruskal-Wallis output

The p-value of the test is lower than alpha level (0.05), and we reject the null hypothesis and conclude that at least the overall satisfaction median of one customer type is statistically different from the others.

, , , ,

Comments are closed.