I have a set of values ${x_i}, i=1, \dots ,N$ of which I calculate the median M. I was wondering how I could calculate the error on this estimation.

On the net I found that it can be calculated as $1.2533\frac{\sigma}{\sqrt{N}}$ where $\sigma$ is the standard deviation. But I did not find references about it. So I do not understand why.. Could someone explain it to me?

I was thinking that I could use bootstrap to have an estimate of the error but I would like to avoid it because it would slow down a lot my analysis.

Also I was thinking to calculate the error on the median in this way $$\delta M = \sqrt{ \frac{\sum_i(x_i - M)^2}{N-1} } $$

Does it make sense?

  • 1
    $\begingroup$ Do you know with absolute certainty that the data are normally distributed? $\endgroup$ Feb 15, 2016 at 12:48
  • $\begingroup$ they are lognormal $\endgroup$
    – shamalaia
    Feb 15, 2016 at 12:52
  • 4
    $\begingroup$ Bootstrap should work and it could not take a long time. Either you have a complete enough dataset and no need to do a bootstrap, just take the median of your variable as a good estimation of the real median. Or you have a rather small dataset and you could use bootstrap to estimate a median with your margin error in no excessive time. $\endgroup$
    – YCR
    Feb 15, 2016 at 12:52
  • 4
    $\begingroup$ You are rather looking for MAD en.wikipedia.org/wiki/Median_absolute_deviation , see also stats.stackexchange.com/questions/122001/… or stats.stackexchange.com/questions/21103/… $\endgroup$
    – Tim
    Feb 15, 2016 at 12:56
  • 2
    $\begingroup$ Extensive information about the distribution of the median appears in my post at stats.stackexchange.com/a/86804/919. It develops the theory needed for both nonparametric and normal-approximation confidence intervals. $\endgroup$
    – whuber
    Feb 15, 2016 at 19:53

2 Answers 2


To directly deal with error on the median you can use the exact nonparametric confidence interval for the median, which uses order statistics. If you want something different, i.e., a measure of dispersion, consider Gini's mean difference. Code is here for the median's confidence interval.

  • $\begingroup$ I was actually considering to use an analog of the Gini coefficient: $S_n=c * med_j (med_j |x_i-x_j|)$ as defined by Rousseeuw and Croux (web.ipac.caltech.edu/staff/fmasci/home/astro_refs/…). $\endgroup$
    – shamalaia
    Feb 15, 2016 at 13:48
  • 1
    $\begingroup$ The median must have an asymmetric error if the data distribution is asymmetric. $\endgroup$ Feb 15, 2016 at 14:19

As pointed out in the other answer, there is a non-parametric CI for the median using the order statistics. That CI is better in many aspects than what you found on the net.

Now, if you must know where the $1.2533\frac{\sigma}{\sqrt{N}}$ factor comes from, the answer is from the asymptotic distribution of the median. If we denote the sample median by $\tilde{\theta}$ and the population median by $\theta$ then it can be shown that

$$\sqrt{n} \left( \tilde{\theta} - \theta \right) \xrightarrow{L} \mathcal{N} \left(0, \frac{1}{4 \left[f \left( \theta \right) \right]^2} \right)$$

where $f$ is the distribution of your sample. The result is not as universal as the CLT because the asymptptic distribution still depends on the underlying distribution of your sample (through the term $\left[f \left( \theta \right) \right]^2$). You can, however, make the drastic simplication that your sample comes from a normal distribution with mean -and median- $\theta$ and variance $\sigma^2$. Evaluating $f$ at its point of symmetry then yields

$$\left[f \left( \theta \right) \right]^2 = \frac{1}{2\pi \sigma^2}$$

and so the asymptotic variance becomes

$$\frac{2\pi}{4} \sigma^2$$.

Divide by $N$ and take the square root of that to arrive at your standard error $1.2533\frac{\sigma}{\sqrt{N}}$.


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.