I'm trying to understand what is the minimum of the following function,

$$ f(\mu) = \frac{1}{n}\sum_{i=1}^n F\left(\frac{\pi(i)}{n}\right) (x_i - \mu )^2 $$

where $F$ is a step function that assign $1$ to any $t \in [0, \gamma]$ and $0$ in $(\gamma, 1]$, $\pi$ is a permutation that sorts the $i$s based on the ascending ordering of the losses $( x_i - \mu )^2$ and $\mu$ and $x_1,\ldots,x_n$ are real numbers. I was thinking that perhaps the minumum of $f$ is achieved by the trimmed mean, namely: sort the $x_i$s discard the first $(1-\gamma)/2$ and the last $(1-\gamma)/2$ of the $x_i$ and compute the arithmetic mean of the remaing points. However, it isn't as a simple numeric example shows.

Any ideas or maybe suggestions (perhaps it is a known problem)? Many thanks in advance.

  • $\begingroup$ Have you worked through some examples? What have you found there? Did all the examples you tried match your conjecture? If you haven't tried that yet, I recommend you try that before asking here. I think that will help you figure out what is going on, and correct your conjecture. $\endgroup$
    – D.W.
    May 24, 2020 at 17:20
  • $\begingroup$ Many thanks indeed it is not the trimmed mean. Unfortunately, I can't figure out other conjectures for the minimum. $\endgroup$
    – Andrea
    May 24, 2020 at 17:35
  • $\begingroup$ Try figuring out what happens for small $n$, say $n=2,3,4$. $\endgroup$ May 24, 2020 at 18:30
  • $\begingroup$ Thanks Yuval, it has been useful to look at small examples. Thanks also to orlp's answer, I think I managed to prove that the minimum is the mean of the subsequence (of continguous elements) with smallest variance. $\endgroup$
    – Andrea
    May 25, 2020 at 10:22

1 Answer 1


Your loss function is proportional to the $\gamma n$ smallest square differences with respect to $\mu$.

This is minimized by sorting your $x_i$ and choosing the mean of the contiguous substring $x_k, x_{k+1}, \dots, x_{k+\gamma n-1}$with the smallest variance.

  • $\begingroup$ Thanks a lot for your answer. $\endgroup$
    – Andrea
    May 25, 2020 at 10:26

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.