Skip to main content
1 of 3

Building on the aswer by StasK and assuming that we don't know the distribution:

Sort the values ($x_0,..,x_i,..,x_{N-1}$). Then Woodruff (1952) suggests to take the difference between the values at half the square root of the sample size above and below the sample median $\tilde{\mu}_s$: \begin{align} \sigma_{\tilde{\mu}_s} \approx x_{\lceil \frac{1}{2}\left(n+\sqrt{n}\right) \rceil} - x_{\lfloor \frac{1}{2}\left(n+\sqrt{n}\right) \rfloor} \end{align} This can intuitively be understood, because the median value deviates from the middle position in a sorted list of random samples by $\frac{\sqrt{n}}{2}$ on average. Expanding this idea, you can also calculate: \begin{align} \sigma^2_{\tilde{\mu}_s} \approx \sum_{i=0}^{N-1} {N-1 \choose i} \left(\frac{1}{2}\right)^{1-N} \left(x_i - \tilde{\mu}_s\right)^2  \end{align} Analogously to the variance of the sample mean, and weighting the quadratic difference of each sample value by its probability of being the closest value to the true median.

The first estimator is easier, faster and more robust, the second may be a little more accurate.