When calculating the median for an even number of samples, we sort the samples and take the arithmetic mean of the two in the middle.

This seems quite arbitrary - it assumes the best way to interpolate between the two samples is a linear interpolation.

Why not use the geometric or some other mean? Wikipedia lists quite a lot of options:

enter image description here

I guess one argument is that a choice needs to be made and any choice would add some bias. Is there a more fundamental reason?

  • 10
    $\begingroup$ it's not: any point between the two middle datapoints minimizes the loss function which defines the median, and can be considered equally acceptable. Taking the arithmetic mean is simply a societal convention (and in my view, a perfectly reasonable one). $\endgroup$ Commented Jan 24, 2023 at 16:09
  • 11
    $\begingroup$ This rule is not entirely arbitrary. It is invariant under reversal of all the data, which makes it particularly attractive for distributions that are symmetric. More generally, it is appropriate when the distribution $F$ is close to symmetric even only near the median $\tilde\mu.$ That is, for a dataset of size $n$ there may be $\epsilon\gg 1/n$ and $p\gt 1$ for which $|F(\tilde\mu+x)+F(\tilde\mu-x)-1|\lt x^p$ for all $0\le x\lt \epsilon.$ $\endgroup$
    – whuber
    Commented Jan 24, 2023 at 16:29
  • 7
    $\begingroup$ Note, too, that this rule is invariant under translation and scaling, which is essential when the units of measurement of the data are arbitrary (which often is the case). Most of the alternative averages in the Wikipedia list do not have this property (apart from min and max). Indeed, some of them aren't even defined for negative values. $\endgroup$
    – whuber
    Commented Jan 24, 2023 at 16:36
  • 2
    $\begingroup$ @whuber: I agree that you shouldn't take anything but an arithmetic average of temperatures if you're measuring them in Fahrenheit or Celsius if you want the average to be invariant with respect to that change. However, both of your examples have a preferred zero point and you can and should take other averages with respect to that. If you're doing thermodynamics working with the en.wikipedia.org/wiki/Boltzmann_constant, you definitely want your temperature measured in Kelvin and then you can take a root-mean square of Kelvin temperatures and have it be physically meaningful. $\endgroup$
    – A. Rex
    Commented Jan 25, 2023 at 14:26
  • 2
    $\begingroup$ @A.Rex I chose the height example precisely because your assertion about a "preferred zero point" is not correct. If that's not completely clear, replace height above the earth with height above a black hole. There is no natural "zero point." Furthermore, even when there is a natural zero, it's not always known or evident in the data. See my analysis at stats.stackexchange.com/questions/35711 for an example. $\endgroup$
    – whuber
    Commented Jan 25, 2023 at 16:08

2 Answers 2


One of the first and best uses of the median is to identify the location (central value) of a dataset or distribution in a robust way. From this perspective it doesn't matter how you choose among alternative values when there is more than one median: they are all equally good.

However, the very meaning of "central value" is questionable when a distribution is not symmetric. (See Why is median age a better statistic than mean age? for some discussion.) But it does have a meaning when the distribution is symmetric near its middle. (The sense of "distribution" includes any dataset, which we may consider to be equivalent to its empirical distribution.)

This means there is some number $\epsilon \gt 0$ for which the distribution is symmetric, or at least very nearly so, for all values within a distance $\epsilon$ of its median. Since "distance" if measured on the scale of the data would be data-dependent, let's measure it in terms of probability. That is, let us say a distribution $F$ (the cumulative function) is "symmetric near a median $\tilde \mu$" when there exists $\epsilon \gt 0$ for which $|F(\tilde\mu+\delta)-1/2|\le \epsilon$ implies $F(\tilde\mu+\delta) + F(\tilde\mu-\delta)=1.$ See https://stats.stackexchange.com/a/29010/919 for a more precise and general approach using a similar formula. The idea is that the shape of the middle part of the distribution comprising a total probability (or proportion) of $2\epsilon$ is symmetric, but using values $\epsilon \lt 1/2$ permits asymmetry to appear in the tails of the distribution.

For discrete distributions (such as empirical distributions) perfect symmetry will rarely be the case due to the jumps in $F$ of size $1/n$ for datasets of size $n.$ We should therefore be willing to relax this requirement to "approximately symmetric in its center" when we have chosen a value $\lambda \ge 0$ and a median $\tilde\mu$ for which

$$|F(\tilde\mu+\delta)-1/2|\le \epsilon \text{ implies }|F(\tilde\mu+\delta) + F(\tilde\mu-\delta)-1| \lt \frac{\lambda}{n}$$

$\lambda$ measures the degree of asymmetry and a value of $\lambda = 1$ (or even a little larger) ought to be acceptable.

One basic technique of data analysis is re-expression (also known as transformation). Depending on the application and meaning of the data, we seek a "natural" or "simple" function $f,$ such as a power (or Box-Cox transformation), which makes the re-expressed data approximately symmetric in its center. If this can be achieved, it permits simplified descriptions and attendant insights, because we can summarize the distribution by giving a single central value that accounts for much of what the data are doing. After that we can focus on describing how its tails might depart from the central part of the distribution: how long or heavy they appear and their degree of asymmetry.

Once we have found such a transformation (it needn't be unique) and applied it to re-express the data, the arithmetic mean of the extreme possible values of the median is a meaningful and appropriate value for the center of a distribution, because it is invariant under reversal of the data -- which, due to the approximate central symmetry, does not appreciably alter the shape of the central part of the distribution. Thus, any proposed median exceeding the arithmetic mean is just as valid as a proposed median falling equally far below the arithmetic mean. The middle is the intuitively obvious choice.

John Tukey exploits a generalization of this idea to develop robust ways to identify and measure the asymmetry of any positive distribution and select a Box-Cox parameter that will make it approximately symmetric in its center. Writing $F_{-}$ for the distribution of the reversed data (that is, $F_{-}(x)$ is the proportion of the data equal to or greater than $x$), you study how the mid-quantiles $\mu_q(F)=(F^{-1}(q) + F_{-}^{-1}(q))/2$ vary with $q,$ for a suitably chosen series of $q$ that probe the tails: usually $q = 1/2, 1/4, 1/8, 1/16, \cdots.$ These mid-quantiles will not vary for as long as the central $1-2q$ portion of the distribution is symmetric. The arithmetic mean of the two middle values in an even-size dataset is precisely $\mu_{1/2}(F).$ For the details, see Tukey's book EDA (Addison-Wesley 1977). My post at https://stats.stackexchange.com/a/582120/919 provides a worked example.


When this happens, I see two options.

  1. Report the median as an interval, which gives us infinitely-many medians instead of just one. (This is not even a confidence interval or credible interval for a point estimate.)

  2. Figure out a way to pick one value.

Picking the arithmetic mean of the middle two points is just one way of doing the estimation. Advantages include the ease with which is is computed and explained. Disadvantages could include bias when there is a skewed distribution.

There are always many ways of estimating a quantity. In fact, the quantile function in R software has at least nine options for computing quantiles like the median. If you have reason to believe that an arithmetic mean of the middle two values has inferior properties to some other form of estimation, you are free to argue why your alternative is better. Plenty of people have seen other estimators that are not optimal for them and have proposed alternatives (e.g., James-Stein estimator).


The following simulation shows the claim by John Madden in the comments that all values in the interval minimize the absolute deviation function whose minimizer is one way to define median.

y <- c(1, 2, 3, 7, 8, 9)
candidate_medians <- seq(2, 8, 0.01)
median_loss <- rep(NA, length(candidate_medians))
for (i in 1:length(candidate_medians)){
  median_loss[i] <- mean(abs(y - candidate_medians[i]))
plot(candidate_medians, median_loss)

enter image description here

All values $M$ between the middle data values, $3$ and $7$ (so $M\in[3,7]$), give equal and minimizing values of $L(y, M) = \frac{1}{n}\sum_{i=1}^n\big\vert y_i-M\big\vert$.

  • $\begingroup$ +1, nice edit. (And as you also comment out, quantile algorithms are... at times a bit of an arbitrary choice/popularity contest.) $\endgroup$
    – usεr11852
    Commented Jan 24, 2023 at 17:05
  • $\begingroup$ Hyndman & Fan (1996), which R's quantile() function relies on and refers to, give a very nice discussion of the nine different ways of computing quantiles. $\endgroup$ Commented Jan 25, 2023 at 7:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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