 # One Sample Median Test

Share on

## What is a one sample median test?

The one sample median test checks whether or not there is a significant difference between our hypothesized median and the real median of a sample.

There are two one sample median tests, the Wicloxon Signed Rank Test and the Sign Test. Both are simple, easy to run tests; the key is that you must choose the hypothesis for the expected mean value before running the analysis, in an a priori manner.

## Choosing a One Sample Median Test for Your Data

The sign test is a good general non-parametric test, which makes very few assumptions (requirements) but has limited power. To use the sign test you need only know that every pair of data points (observations) are ordered, for instance, x > y.

If all your data points (all your observations) can be given a rank value >a value like first, 2nd, 3rd, etc…, and if you have a symmetric distribution, the Wilcoxon signed-rank test can be used.

So, since it begins with more assumptions, the Wilcoxon signed-rank test is more specific, with a narrower focus; but it also (usually) has more power to find differences than the more general sign test.

## The One Sample Sign Test

To understand the one sample sign test, let’s look at a very simple example. Suppose you manage a zoo and you hypothesize that the median age of children visiting is 8. This becomes your null hypothesis, H0: the median age of children is 8.

Suppose now you took a sample of ten children whose ages turn out to be 1, 2, 2, 4, 5, 7, 10, 12, 15, and 17. To run the test:

Step 1: Assign a value of 0 to those with ages below your hypothesized median, and 1, to those above. If you had any eight-year-olds—which you haven’t—they would not be counted at all.
1-0
2-0
2-0
4-0
5-0
7-0
10-1
12-1
15-1
17-1

Step 2: Find the obtained frequency (of). There are six children with ages below the median (the median is 8), and four above.
of = 4 and 8.

Step 3: Find the expected frequency (ef). The total number of data points—children—is ten. If 8 was a true median, we’d expect to have five children over aged eight and five below.
ef = 5.

Step 4: Calculate the chi-square:

Χ2 = Σ [(of – ef)2/ef].

This is:
(6 – 5)2/5 + (4 – 5)2/5

or 0.20 + 0.20 = 0.40.

Step 5: Find the degrees of freedom. There are two observed frequencies (equal to two cells in a contingency table), so there is just one degree of freedom.

Step 6: Use a Chi-squared table to find the critical chi-square value
for 1 degree of freedom and an alpha level of 0.05 (α = 0.05). This equals 3.84.

Since our Χ2 value of 0.40 is less than the critical Χ2 value of 3.84, we fail to reject the null hypothesis (i.e. we can keep it) —that the median age of children at the zoo is 8. If the Χ2 value we calculated from our data had been more than the critical Χ2 value, we would be able to reject the null hypothesis and postulated median age of 8.

## References

Non-Parametric Tests

Stata Manual, R Signrank: Equality Tests on Matched Data