The median $\tilde{\mu}$ of a sample in many ways is analogous to the sample mean $\mu$. Both are an estimate for the population median or mean respectively, and both approach a Gaussian distribution for a large sample under certain conditions. It is known that the median asymptotically approaches a Gaussian distribution with variance $\sigma^2_{\tilde{\mu}}$ if the density $p(\tilde{\mu})$ is nonzero and continuously differentiable around the median (Rider 1960): \begin{align} \sigma^2_{\tilde{\mu}} = \frac{1}{4 N \left(p\left(\tilde{\mu}\right)\right)^2} \end{align} If the samples $x_i$ have the same mean but different variances $\sigma_i^2$, it can be shown that the inverse variance weighted sample mean ${_w\mu}$ is the estimate for the population mean with the lowest variance $\sigma^2_{_w\mu}$. \begin{align} {_w\mu} &= \frac{\sum_{i=1}^N w_i x_i }{\sum_{i=1}^N w_i}\\ w_i &= \sigma_i^{-2}\\ \sigma_{_w\mu}^2 &= \dfrac{1}{\sum_{i=1}^N w_i} \end{align} I am looking for an equivalent for the median. The weighted sample median ${_w\tilde{\mu}}$ is any value, which partitions the weights associated with values less than or equal and the weights of the values larger than or equal so their sums differ the least: \begin{align} {_w\tilde{\mu}} = \min_{_w\tilde{\mu}} \left| \left( \sum_{ \left\{ i | x_i \le _w\tilde{\mu} \right\} } w_i \right) - \left( \sum_{ \left\{ i | x_i \ge _w\tilde{\mu} \right\} } w_i \right) \right| \end{align} Now the question arises, what is the variance of the weighted sample median and how to set the weights optimally? I thought things like these must have been proven in the past a long time ago, but I was not able to find anything. I'd be thankful if you can help me find out more. This is how far I got on my own:
If samples have a different variance they must have come from a different distribution, so let's assume each sample is drawn from a different probability distribution $p_i$. Numerical experiments seem to indicate that in order to minimize the variance of the weighted median the weights should be set proportional to the density at the median of the distribution the sample was drawn from $p_i({_w\tilde{\mu}})$. This also makes a nice connection to inverse variance weights that are optimal for the weighted average, because in the weighted median, asymptotically each sample contributes a variance inversely proportional to the square of this density. Fig. 1: Relative weighting between samples following a Gaussian or uniform distribution with identical varianance each. The ratio of the Gausian density to the uniform density at the median is $\sqrt{\frac{6}{\pi}} \approx 1.38$ , this ratio is reached at around $0.58$ on the x-axis, coinciding with the minimum variance of the weighted sample median.
Fig. 2: The median of absolute deviations of the sample median of samples following either a gaussian, a Laplacian or a uniform distribution, with variances following an exponential distribution. The weights are set to a power of the associated sample variances and as can be seen the optimal power is around $0.5$.
When the weights are set equal to $p(\tilde{\mu})$ the variance of the median seems to approach: \begin{align} \sigma^2_{\tilde{\mu}} = \frac{1}{4 \left(\sum \left(p_i\left(\tilde{\mu}\right)\right)^2\right)} \end{align}
Rider 1960: https://www.tandfonline.com/doi/abs/10.1080/01621459.1960.10482056