# 12.7: Rank Randomization Two or More Conditions

• • David Lane
• Rice University
$$\newcommand{\vecs}{\overset { \rightharpoonup} {\mathbf{#1}} }$$ $$\newcommand{\vecd}{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}}$$$$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\id}{\mathrm{id}}$$ $$\newcommand{\Span}{\mathrm{span}}$$ $$\newcommand{\kernel}{\mathrm{null}\,}$$ $$\newcommand{\range}{\mathrm{range}\,}$$ $$\newcommand{\RealPart}{\mathrm{Re}}$$ $$\newcommand{\ImaginaryPart}{\mathrm{Im}}$$ $$\newcommand{\Argument}{\mathrm{Arg}}$$ $$\newcommand{\norm}{\| #1 \|}$$ $$\newcommand{\inner}{\langle #1, #2 \rangle}$$ $$\newcommand{\Span}{\mathrm{span}}$$$$\newcommand{\AA}{\unicode[.8,0]{x212B}}$$

Learning Objectives

• Compute the Kruskal-Wallis test

The Kruskal-Wallis test is a rank-randomization test that extends the Wilcoxon test to designs with more than two groups. It tests for differences in central tendency in designs with one between-subjects variable. The test is based on a statistic $$H$$ that is approximately distributed as Chi Square. The formula for $$H$$ is shown below:

$H = -3(N+1) + \frac{12}{N(N+1)} \sum_{i=1}^{k} \frac{T_{i}^{2}}{n_i}$

where

• $$N$$ is the total number of observations
• $$T_i$$ is the sum of ranks for the $$i^{th}$$ group
• $$n_i$$ is the sample size for the $$i^{th}$$ group
• $$k$$ is the number of groups

The first step is to convert the data to ranks (ignoring group membership) and then find the sum of the ranks for each group. Then, compute $$H$$ using the formula above. Finally, the significance test is done using a Chi Square distribution with $$k-1$$ degrees of freedom.

For the "Smiles and Leniency" case study, the sums of the ranks for the four conditions are:

• False: $$2732.0$$
• Felt: $$2385.5$$
• Miserable: $$2424.5$$
• Neutral: $$1776.0$$

Note that since there are "ties" in the data, the mean rank of the ties is used. For example, there were $$10$$ scores of $$2.5$$ which tied for ranks $$4-13$$. The average of the numbers $$4, 5, 6, 7, 8, 9, 10, 11, 12,13$$ is $$8.5$$. Therefore, all values of $$2.5$$ were assigned ranks of $$8.5$$.

The sample size for each group is $$34$$.

$H = -3(136+1) + \frac{12}{(136)(137)} \left ( \frac{(2732)^2}{34} + \frac{(2385.5)^2}{34} + \frac{(2424.5)^2}{34} + \frac{(1776)^2}{34} \right ) = 9.28$

Using the Chi Square Calculator for $$\text{Chi Square} = 9.28$$ with $$4-1 = 3\; df$$ results in a $$p$$ value of $$0.0258$$. Thus the null hypothesis of no leniency effect can be rejected.

This page titled 12.7: Rank Randomization Two or More Conditions is shared under a Public Domain license and was authored, remixed, and/or curated by David Lane via source content that was edited to the style and standards of the LibreTexts platform; a detailed edit history is available upon request.