I have a set of real numbers $x_1,\ldots,x_n$. I would like estimate the mean of the set, $y$, such that the median of squares will be minimal : $\operatorname{median}(x_i-y)^2$
Is there a closed form formula for this problem or a series of steps to finding $y$? How do I prove it provides the minimum for this function?
To stress out - I'm not estimating really - I need an accurate answer that minimizes the median of the square distances.
Thanks


I'd be willing to bet that there is no closed form solution to this problem since it involves sorting. I don't think there is an algorithm involving some fixed number of steps either. However, it would usually be possible to do this using numerical methods.
Here's an example using the Python scipy software.
14.999999999999993
... meaning that 15 would be the estimate for the mean in this sample. The software is using Brent's method of optimisation to get a minimum.