29.2 Testing for a median using the binomial distribution

In any set of data, we’d expect half the values to lie either above or below the median11 1 This is from how the median is defined.. The probability distribution of the number of values above (or below) the median (XX) can be defined as

XB(n,12)X\sim B\left(n,\frac{1}{2}\right) (29.1)

We can use this to carry out a hypothesis test to see if a set of data has a given median; we count up the total number of observations, and how many are above or below the median. We can then work out the probability of how likely it would be to see that value (or a more extreme value) under the null hypothesis.