## The α-trimmed Mean

• This document contains directions for computing the α-trimmed mean of a univariate dataset in SPSS, with column named x, having n observations.

Note:   This procedure is complicated by the fact that α may not be an even multiple of 1/n.

1. Sort the dataset by x.

2. Add a new variable named weights that will be the weights used to compute a weighted average. This weighted average will be the α-trimmed mean. Initialize all of the weights in the new column to 1/n. Name this new column "weights." You can do this using Transform >> Compute Variable.

3. Use the data editor to repeatedly set the weights for observations at the top and bottom of the list to 0. This is essentially "trimming" the dataset. Keep doing this while there are still more than α of the observations with a non-zero weight. Let k be the number of observations remaining with a non-zero weight. Trim as many observations as possibe such that k/n stays greater than α: if two more observations are removed from the top and bottom, k/n < α.

4. Solve for the weights w to be assigned to the two most extreme remaining observations with non-zero weights:

2w + (k - 2) * (1 / n) = 1 - α

Change the weights of the two most extreme remaining observations with non-zero weights to w, downweighted from 1/n.

5. Compute the sum S of the new weights.

6. Normalize the weights by dividing each of them by S. Use Transform >> Compute Variable to do this. The sum of the weights after normalization should be 1.

7. Compute the weighted sum of the observations by using Transform >> Compute Variable. Compute the new variable y = x * weight. The sum of the values of y is the α-trimmed mean.

• Example:   Compute the 0.2-trimmed mean of this list with n = 13:

45     63     89     71     3     86     212     69     56     91     101     70     84

1. Sort the list:

3     45     56     63     69     70     71     84     86     89     91     101     212

2. Compute the new variable weights as 1/n = 1/13 = 0.076923.

0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923

3. If we set the value of weight for the top and bottom observation (with x = 3 and x = 212) to 0, we have set the fraction 2 * (1/n) = 0.153846 of the weights to 0. Since 2 * (1/n) = 2/n = 0.153846 and α = 0.2, we still have 2 * (1/n) / n < α. So far so good; k is now 11.

However, if we remove two more observations (with x = 45 and x = 101), we have set the fraction 4 * (1/n) = 0.307692 to zero, so it is no longer true that 4 * (1/n) < α. k stays at 11. The column of weights is now

0.000000
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.000000

4. Solve for the weights to use for the observations corresponding to x = 45 and x = 101:

2w + (k - 2) * (1 / n) = 1 - α

2w + (11 - 2) * (1 / 13) = 1 - 0.2

2w = 0.692308 = 0.8 w = 0.053846

Change the weights of the observations corresponding to x = 45 and x = 101 to 0.053846. The weight column should now be

0.000000
0.053846
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.076923
0.053846
0.000000

5. Compute the sum of the weight column. It is 0.800000, which is equal to α, as it should be.

6. Normalize the weight column by dividing each weight by the sum 0.8.

Here are the normalized weights:

0.000000
0.067308
0.096154
0.096154
0.096154
0.096154
0.096154
0.096154
0.096154
0.096154
0.096154
0.067308
0.000000

Check that these normalized weights sum to 1.

7. Use these weights to compute the weighted average of the dataset. The weighted average is 75.115. Compare this to the sample mean 80 and the median 71.