6
$\begingroup$

I'm experimenting with the trim parameter to the mean function, E.g.

dy <- c(1:10, 1000)  
> mean(dy)
[1] 95.90909
> mean(dy, trim=0.2)
[1] 6
> median(dy)
[1] 6

How should I decide how much to trim? Should I try different trim values and compare the output to other measures such as median until I find the optimum trim value, or should I be selecting the optimum trim value by some other mechanism?

$\endgroup$
3
  • $\begingroup$ optimum in what sense? $\endgroup$
    – user603
    Jun 10, 2015 at 19:17
  • 1
    $\begingroup$ In the sense that is there some logic I should apply when choosing a value? At the moment, I'm arbitrarily choosing values and seeing what the result looks like which feels wrong. $\endgroup$
    – Chris Snow
    Jun 10, 2015 at 19:27
  • $\begingroup$ Why do you need to trim at all? $\endgroup$
    – EdM
    Jun 10, 2015 at 20:18

1 Answer 1

11
$\begingroup$

Given a sample $\pmb x=\{x_i\}_{i=1}^n$ and, for an integer $1\leq m\leq n$ denoting $x_{(m)}$ the $m$-th largest entry of $\pmb x$, and $\alpha\in(0,0.5)$ define the $\alpha$ trimmed mean as:

$$\hat{\mu}_{\alpha}=\frac{1}{(1-2\alpha)n}\sum_{i=[n\alpha]+1}^{n-[n\alpha]}x_{(i)}$$

For any symmetric continuous distribution $F_X$, $\hat{\mu}_{\alpha}$ is unbiased for the centre of symmetry and (assuming without loss of generality that $F_X$ is centred at 0) the asymptotic variance of $\hat{\mu}_{\alpha}$ is:

$$V(\hat{\mu}_{\alpha})=\frac{2}{(1-2\alpha)^2}\left(\int_0^{F^{-1}(1-\alpha)}x^2dF_X(x)+\alpha(F^{-1}_X(1-\alpha))^2\right)$$.

so from an estimation accuracy (at uncontaminated samples from symmetric distributions) point of view, if $F_X$ is light tailed, to increase efficiency (equivalently, to decrease the asymptotic variance), you would pick $\alpha=0$.

Of course, the breakdown point of the trimmed mean is $\alpha$, so to increase robustness, you would pick $\alpha=0.5$.

Note that this trade-off only holds under the conditions elicited above. For heavy tailed symmetric distributions, you can increase robustness and ARE by increasing $\alpha$. For example, for a $t_3$ distribution, the ARE of the 0.25 trimmed mean is about 15% better than that of the 0.05-trimmed mean.

Note also that the two criteria (robustness vs efficiency) don't balance: the loss in estimation accuracy due to choosing a too big value of $\alpha$ in contaminated settings can potentially far exceed the loss in estimation accuracy due to choosing a too small value of $\alpha$ on clean data.

More precisely, denoting $F^{\varepsilon}_X$ the contaminated distribution obtained by contaminating a square integrable, continuous distribution $F_X$ by a proportion $\varepsilon<0.5$ of arbitrary values, then, the supremum over all such contaminated distributions $F^{\varepsilon}_X$ of the relative asymptotic efficiency of the 0-trimmed vs the 0.5 one: $$(1)\quad\underset{F^{\varepsilon}_X}{\sup}\frac{V(\hat{\mu}_0)}{V(\hat{\mu}_{0.5})}$$ is unbounded. However, the reciprocal of $(1)$ is always bounded (see [2], p75).

Unless you are willing to assume more about the rate of contamination of the sample and the distribution of the good part of the data, there is no way to resolve this issue with the trimmed mean. A single parameter $\alpha$ controls for both robustness and accuracy so that you have to trade them off. An alternative is to take another estimator, one pre-tuned to attain high efficiency for a fixed breakdown point for a given distribution of the good part of the data. Consider the MM estimator[0]:

library(robustbase)
x<-c(rnorm(10,0,1),rnorm(40,11,1)) #sample
lmrob(x~1)$coef   #MM estimate of location

or the $\tau$ estimator of location[1]:

scaleTau2(x,mu.too=TRUE)[1]

Like the trimmed mean, both the $\tau$ and MM estimates are unbiased and asymptotically normal at symmetric distributions. In contrast to trimmed means, these estimator use two parameters so you can set the breakdown point independently of the ARE. Consequently, you can achieve an ARE arbitrarily close to 1 and maintain the 50% breakdown point. For example, by default, the MM estimator is tuned to achieve 95% efficiency at the Gaussian model (i.e. if the uncontaminated part of the data is Gaussian) with a breakdown point of 50%. The $\tau$ estimator of location is slightly less efficient at the Gaussian model (80%) but retains the same (or better) efficiency against a range of alternative distributions (for the good part of the data), including the Cauchy (again with a breakdown point of 50%). See more in the paper below (they concern regression but mean estimation is a particular case of regression).

  • [0] Yohai, V.J. (1987) High breakdown-point and high efficiency estimates for regression. The Annals of Statistics 15, 642--65.
  • [1] Yohai, V.J. and Zamar, R.H. (1988). High breakdown-point estimates of regression by means of the minimization of an efficient scale. Journal of the American Statistical Association 83, 406–413.
  • [2] Staudte, R.G. and Sheather, S.J. (1990). Robust Estimation and Testing.
$\endgroup$
2
  • 4
    $\begingroup$ +1 I knew I was in good hands at the outset when you explained what this code was intended to do, at once clarifying the question and making the thread accessible even to people unfamiliar with R. $\endgroup$
    – whuber
    Jun 10, 2015 at 23:34
  • $\begingroup$ As usual, it took me quiet a bit of editing, but thanks for the comment! $\endgroup$
    – user603
    Jun 11, 2015 at 8:14

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.