1
$\begingroup$

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?

$\endgroup$
7
  • 1
    $\begingroup$ You have to think it as an equilibrium point. $\endgroup$
    – Sigur
    Aug 14, 2013 at 1:07
  • 1
    $\begingroup$ The centre of gravity is the mean. $\endgroup$ Aug 14, 2013 at 1:41
  • $\begingroup$ By most reasonable interpretations, if you count 2 as just one "value", you'd still want to give it twice as much weight in almost anything you do, as you would if it had been there only once. $\endgroup$ Aug 14, 2013 at 2:29
  • $\begingroup$ @Synetech : True: I've never thought the mode was good for much. $\endgroup$ Aug 14, 2013 at 18:12
  • $\begingroup$ @Synetech : I had in mind the mode of a quantitative variable rather than a categorical one. (But I don't know how much the mode is worth in TV ratings either, unless it's for winning awards.) $\endgroup$ Aug 14, 2013 at 18:24

1 Answer 1

1
$\begingroup$

The notion you are looking for is sample median (as opposed to population median).

Sort the sample values, respecting multiplicity. So if we got $7.8$ three times, we write it down $3$ times. One can use non-decreasing order or non-increasing order, it doesn't matter.

If the number of sample values is odd, say $2k+1$, then the sample median is the "middle" value, that is, the $(k+1)$-th value counting from the bottom (or top) of the sorted list.

If the number of sample values is odd, say $2k$, then the sample median is the ordinary average of the two "middle" values. the $k$-th and the $(k+1)$-th.

$\endgroup$
8
  • $\begingroup$ If you look a few lines down from the anchor you linked to on that page, you’ll see that it is the one that gives 4 as the median. I’m looking for a term for the calculation that would return 6. I tried looking for population median instead, but it was only used four times in the page and none of them defined it as what I’m wondering about (or at all for that matter). $\endgroup$
    – Synetech
    Aug 14, 2013 at 2:23
  • $\begingroup$ Population median is defined for a probability distribution. In the case of "ambiguity" of the type we meet with samples, all "middle" values are declared to be medians. So in our case it would be all numbers between $0$ and $6$ inclusive. The top of this range of medians, and the bottom, have no special names. In the finite case, any point $p$ that minimizes the sum of the absolute values $\sum |x_i-p|$ is a median. $\endgroup$ Aug 14, 2013 at 2:32
  • $\begingroup$ Discarding entries that happen to repeat would not make statistical sense. One could call the result $6$ the median of the set of values. $\endgroup$ Aug 14, 2013 at 2:39
  • $\begingroup$ Discarding entries that happen to repeat would not make statistical sense. How so? Most statistics ignore some attribute or another. The mode ignores all of the other values, and yet is frequently used. One could call the result 6 the median of the set of values. “Could” because there is no existing, formal name? $\endgroup$
    – Synetech
    Aug 14, 2013 at 4:22
  • $\begingroup$ There is no existing name that I know of used in Statistics. The median of the set of values is technically the correct name $\endgroup$ Aug 14, 2013 at 4:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .