Example of Kruskal-Wallis Test

A health administrator wants to compare the number of unoccupied beds for three hospitals in the same city. The administrator randomly selects 11 different days from the records of each hospital and enters the number of unoccupied beds for each day.

To determine whether the median number of unoccupied beds differs, the administrator uses the Kruskal-Wallis test.

  1. Open the sample data, HospitalBeds.MTW.
  2. Choose Stat > Nonparametrics > Kruskal-Wallis.
  3. In Response, enter Beds.
  4. In Factor, enter Hospital.
  5. Click OK.

Interpret the results

The sample medians for the three hospitals are 16.00, 31.00, and 17.00. The average ranks show that hospital 2 differs the most from the average rank for all observations and that this hospital is higher than the overall median.

Both p-values are less than 0.05. The p-values indicate that the median number of unoccupied beds differs for at least one hospital.

Descriptive Statistics

HospitalNMedianMean RankZ-Value
Overall33  17.0 


Null hypothesisH₀: All medians are equal
Alternative hypothesisH₁: At least one median is different
Not adjusted for ties27.050.029
Adjusted for ties27.050.029