The Median test investigates the difference between the medians of two independent samples of sizes
${n}_{1}$ and
${n}_{2}$, denoted by:
and
where
$n={n}_{1}+{n}_{2}$.
The test proceeds by forming a
$2\times 2$ frequency table, giving the number of scores in each sample above and below the median of the pooled sample:

Sample 1 
Sample 2 
Total 
Scores $<$ pooled median 
${i}_{1}$ 
${i}_{2}$ 
${i}_{1}+{i}_{2}$ 
Scores $\ge $ pooled median 
${n}_{1}{i}_{1}$ 
${n}_{2}{i}_{2}$ 
$n\left({i}_{1}+{i}_{2}\right)$ 
Total 
${n}_{1}$ 
${n}_{2}$ 
$n$ 
Under the null hypothesis,
${H}_{0}$, we would expect about half of each group's scores to be above the pooled median and about half below, that is, we would expect
${i}_{1}$, to be about
${n}_{1}/2$ and
${i}_{2}$ to be about
${n}_{2}/2$.
If on entry
${\mathbf{ifail}}=0$ or
$1$, explanatory error messages are output on the current error message unit (as defined by
x04aaf).
The probability returned should be accurate enough for practical use.
This example is taken from page 112 of
Siegel (1956). The data relate to scores of ‘oral socialisation anxiety’ in
$39$ societies, which can be separated into groups of size
$16$ and
$23$ on the basis of their attitudes to illness.