Lets say that the dataset has 3 observations namely 1, 2 and 3. The median is 2. Is 3, which is above the median, 50% of the dataset? How to correctly interpret the median?

  • $\begingroup$ If you have large numbers of repeated values at the median, then the numbers above and below can become vanishingly small. $\endgroup$
    – James
    Nov 2, 2016 at 14:42
  • $\begingroup$ There are actually multiple definitions of quantiles (and therefore also medians) that differ subtly. For instance, the R quantile() function takes a type argument that can take nine different values. Take a look at Hyndman & Fan (1996, The American Statistician). $\endgroup$ Nov 2, 2016 at 16:00
  • $\begingroup$ Understanding "above" to mean "greater" and "below" to mean "less than," it is accurate if you replace each "50%" by "at most 50%." $\endgroup$
    – whuber
    Nov 3, 2016 at 16:53

2 Answers 2


Sample median is defined as a value $\hat{x}$ that splits the samples $x_i$ of a data set $X$ such that at least 50% of the samples are greater or equal and at least 50% are less or equal than $\hat{x}$. Because you only have a finite sample set the median can only be approximated.

Assuming the samples are sorted, such a value can be computed by the following formula:

$$ \hat{x}= \begin{cases} x_{\frac{n+1}{2}},\hspace{3cm} \text{if n is odd}\\ \frac{1}{2}\left( x_{\frac{n}{2}} + x_{\frac{n}{2} + 1} \right),\hspace{0.72cm} \text{if n is even} \end{cases} $$

where $n$ is the number of samples. In your example $X = \{1, 2, 3\}$, $n = 3$, which means case 1 applies:

$$ \hat{x} = x_{\frac{3 + 1}{2}} = 2 $$

This means that there are two samples $x_i \in \{1, 2\}$ that satisfy $x_i \leq \hat{x}$ and two samples $x_i \in \{2, 3\}$ that satisfy $x_i \geq \hat{x}$.

So it's exactly as we wanted it to be.

The concept can be generalized to quantiles. A $p$ quantile $\hat{x}_p$ is a a value that splits the samples such that at least $p \dot{}$ 100% of the samples are less or equal then $\hat{x}_p$ and at least $(1 - p) \dot{}$ 100% of the samples are greater or equal then $\hat{x}_p$. So the sample median is the $0.5$ quantile.

The formula then becomes the following:

$$ \hat{x}_p= \begin{cases} x_{\lceil p\dot{}n \rceil},\hspace{3cm} \text{if $p \dot{} n$ is an not integer}\\ \frac{1}{2}\left(x_{p\dot{}n} + x_{p\dot{}n + 1} \right),\hspace{0.72cm} \text{if $p \dot{} n$ is an integer} \end{cases} $$

where $n$ is the number of samples, $p$ the quantile, and $\lceil x \rceil$ is the ceiling function.

Some quantiles have names, because they are used often. Such as $0.5$ quantile is called median, $0.33$ quantile si the tercile, and so on.

  • 2
    $\begingroup$ |t is worth mentioning that this is a formula for sample median, not a median for a distribution that is defined as a point that marked by the 0.5 quantile of the distribution. $\endgroup$
    – Tim
    Nov 2, 2016 at 12:03
  • $\begingroup$ Thanks. Does this definition of median extend to how we interpret quartiles, deciles and percentiles? $\endgroup$ Nov 2, 2016 at 12:55
  • $\begingroup$ Yes, it does. @Tim: Yes, you are right. I added it. I thought it was clear from context. $\endgroup$
    – hh32
    Nov 2, 2016 at 13:24
  • 3
    $\begingroup$ I disagree with "the" --- there may be an interval of values. For example, if the data are the integers 1:10, anything in $(5,6)$ satisfies this definition. $\endgroup$
    – JDL
    Nov 2, 2016 at 14:36
  • 1
    $\begingroup$ @HeinkeHihn: I think JDL's point is just that your English description doesn't match the formula. More accurate to would be to say for example that it's defined as "a value that splits a data set... specifically it's the one given by this formula". $\endgroup$ Nov 2, 2016 at 19:42

Your statement is exactly accurate when the dataset has even number of observations (so that the median is calculated from the two "middle" ones) and almost accurate when you have an odd number of observations (because the middle one is neither above nor below the median). If you are concerned about precise terminology, you could say that median is a score where equal numbers of observations are above and below it, but your interpretation sounds fine in all practical situations.

  • 2
    $\begingroup$ This is wrong, consider 1,2,3,3,4 $\endgroup$
    – Taemyr
    Nov 2, 2016 at 17:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.