How to Perform a Kruskal-Wallis Test in Excel


Kruskal-Wallis Test is used to determine whether or not there is a statistically significant difference between the medians of three or more independent groups. It is considered to be the non-parametric equivalent of the One-Way ANOVA.

This tutorial explains how to conduct a Kruskal-Wallis Test in Excel.

Example: Kruskal-Wallis Test in Excel

Researchers want to know if three different fertilizers lead to different levels of plant growth. They randomly select 30 different plants and split them into three groups of 10, applying a different fertilizer to each group. At the end of one month they measure the height of each plant.

Use the following steps to perform a Kruskal-Wallis Test to determine if the median growth is the same across the three groups.

Step 1: Enter the data.

Enter the following data, which shows the total growth (in inches) for each of the 10 plants in each group:

Raw data in three columns in Excel

Step 2: Rank the data.

Next, we will use the RANK.AVG() function to assign a rank to the growth of each plant out of all 30 plants. The following formula shows how to calculate the rank for the first plant in the first group:

Copy this formula to the rest of the cells:

Then, calculate the sum of the ranks for each column along with the sample size and the squared sum of ranks divided by the sample size:

Step 3: Calculate the test statistic and the corresponding p-value.

The test statistic is defined as:

H = 12/(n(n+1)) * ΣRj2/nj – 3(n+1)

where:

  • n = total sample size
  • Rj2 =sum of ranks for the jth group
  • nj =sample size of jth group

Under the null hypothesis, H follows a Chi-square distribution with k-1 degrees of freedom.

The following screenshot shows the formulas used to calculate the test statistic, H, and the corresponding p-value:

 Kruskal Wallis test calculation in Excel

The test statistic is H = 6.204 and the corresponding p-value is p = 0.045. Since this p-value is less than 0.05, we can reject the null hypothesis that the median plant growth is the same for all three fertilizers. We have sufficient evidence to conclude that the type of fertilizer used leads to statistically significant differences in plant growth.

Step 4: Report the results.

Lastly, we want to report the results of the Kruskal-Wallis Test. Here is an example of how to do so:

A Kruskal-Wallist Test was performed to determine if median plant growth was the same for three different plant fertilizers. A total of 30 plants were used in the analysis. Each fertilizer was applied to 10 different plants.

 

The test revealed that the median plant growth was not the same (H = 6.204, p = 0.045) among the three fertilizers. That is, there was a statistically significant difference in median plant growth among two or more of the fertilizers.

Leave a Reply

Your email address will not be published. Required fields are marked *