Problem:
Consider the following model:
$y_i = \mu + \epsilon_i$, $i = 1,...,n$
Let the mean $\mu$ be estimated by minimizing the criterion $\sum|\mu - y_i|$ over $\mu$.
Show that $m = $median($y_1,y_2,...,y_n$) is optimal for this criterion.
Distinguish the case $n$ is odd and $n$ is even.
My idea to approach the problem:
$1)$ Rewrite the criterion such that no absolute signs are needed (with indicator function for example).
$2)$ Determine the first order condition to recognize the median.
$3)$ Order data to distinguish $n$ odd or $n$ even
However, I dont't know how to to the steps of my apporach in a mathematical/statistical way.
Could anyone please help me?
I think you are asking why $\sum|\mu-y_j|$ is minimized, as a function of $\mu$, by taking $\mu=m$, where $m$ is the median of the $y_j$. The answer is, as you shift $\mu$ away from the median, more terms in the sum increase than decrease.
See also https://scicomp.stackexchange.com/questions/816/optimizing-the-sum-of-the-absolute-values