# Minimizing Trimmed Distances

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.

• 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.
– D.W.
May 24, 2020 at 17:20
• Many thanks indeed it is not the trimmed mean. Unfortunately, I can't figure out other conjectures for the minimum. May 24, 2020 at 17:35
• Try figuring out what happens for small $n$, say $n=2,3,4$. May 24, 2020 at 18:30
• 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. May 25, 2020 at 10:22

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.