I’m writing a computer program that provides some useful statistical information about files. Calculating the mean is trivial, and the mode at least has a simple definition, but the median is proving tricky. I remember its general definition from school, but there is some ambiguity.
Median: the “middle number”.
But what does that mean? Is it the middle entry or the middle value?
The Wikipedia page for mean uses the sample data set
1, 2, 2, 6, 7, 8 and gives the median as 4 because the mean of the two middle entries (2 and 6) is 4.
But what about 6? The number 6 has the same number of values above (7,8) as it does below (1,2).
This is a pretty useful statistic as well. Is there a name for this?