nag_median_test (g08acc) performs the Median test on two independent samples of possibly unequal size.
The Median test investigates the difference between the medians of two independent samples of sizes
${n}_{1}$ and
${n}_{2}$, denoted by:
The hypothesis under test,
${H}_{0}$, often called the null hypothesis, is that the medians are the same, and this is to be tested against the alternative hypothesis
${H}_{1}$ that they are different.
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 $\le $ 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$ 
nag_median_test (g08acc) returns:
(a) 
the frequencies ${i}_{1}$ and ${i}_{2}$; 
(b) 
the probability, $p$, of observing a table at least as ‘extreme’ as that actually observed, given that ${H}_{0}$ is true. If $n<40$, $p$ is computed directly (‘Fisher's exact test’); otherwise a ${\chi}_{1}^{2}$ approximation is used. 
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.