The procedure below draws on NAG algorithms.
The median test investigates the difference between samples of sizes denoted by
If the median value is not given by the user, the combined data from all groups are sorted and the median is calculated:
,if n is even;, if n is odd.
Where , is the ordered data of all observations from small to large.
The test proceeds by forming a frequency table, giving the number of scores in each sample above and below the median of the pooled sample:
The statistic foe all nonempty samples is calculated as:
The significance level is from the distribution with degrees of freedom, where is the number of nonempty samples. A message is printed if any cell has an expected value less than one, or more than 20% of the cells have expected values less than five.