R.A. Fisher (1936) measured various characteristics of three different iris species in order to search for relationships between the variables. From the introduction of his paper:
When two or more populations have been measured in several characters… special interest attaches to certain linear functions of the measurements by which the populations are best discriminated.
We will be using each of these different species as our groups/populations for a Kruskal-Wallis test. Out of the variables that Fisher measured, we will test for differences in sepal width among the groups. The sepal is the green leaf-like appendage found outside/below a flower’s petals. It plays a crucial role in protecting the bud before bloom and supports the petals after bloom. In short, we are looking to see if the three different iris species (Iris setosa, versicolor, and virginica) have equal medians for sepal width or not. Testing for differences in this measure could be useful in quantifying the differences between the three iris species.
a. b.
Picture credit: Danielle Langlois July 2005 Quebec Canada; Quora 2018
Fig. 1. Iris versicolor (a) and diagram of sepal (b).
In this instance, we will assume that the assumptions necessary for an ANOVA were not met, leading us to consider a Kruskal-Wallis test. (Note that the parametric test not having its conditions satisfied is not necessarily a requirement for using a nonparametric test, although it is usually the scenario when we turn to these procedures.) Can we run a Kruskal-Wallis test? To find out, we will check for a shift model, which we can do by comparing box-and-whisker (boxplot) and density plots between groups (see common statistics plots page).
Fig. 2 Overlaid box-and-whisker and density plots comparing the different iris species (units in cm).
The three distributions look reasonably similar, with their centers being the only big difference, so the shift model is appropriate here. Assuming randomness and independence, which we can do here as this data was collected for a scientific paper (if you collected your data yourself you will want to check this), we can then run the Kruskal-Wallis test, the code for which is below. This command requires long data (see long vs. wide data page), so make sure to rearrange your data in Excel before running the test if it is wide.
With a very high test statistic of 63.57 and a very low p-value of approximately 0, under any reasonable alpha level, we reject the null hypothesis that all the populations have the same median, and conclude that at least one group has a different median. Note that this procedure does not tell us specifically which of the groups differ in their medians, just that not all of the population medians are equal. After finding a significant result in a one-way ANOVA or Kruskal-Wallis test, we can use post-hoc tests to tell in specifically which groups the differences lie.
Dataset Source
Fisher, R. A. (1936) The use of multiple measurements in taxonomic problems. Annals of
Eugenics, 7, Part II, 179–188.
Pictures Cited
“Iris (Iridaceae).” Wikimedia Commons, Wikimedia Foundation, Inc., 9 Sept. 2017, commons.wikimedia.org/wiki/Iris_(Iridaceae)#/media/File:Iris_versicolor_3.jpg. Accessed 26 July 2019.
“What is the difference between sepals and petals?” Quora, 3 Sept. 2018, www.quora.com/What-is-the-difference-between-sepals-and-petals. Accessed 26 July 2019.