[R] trimmed mean in R seems to round the trimming fraction

VINOD@FORDHAM.EDU VINOD at FORDHAM.EDU
Sun Sep 18 21:37:08 CEST 2005




subject: trimmed mean in R seems to round the trimming fraction
to r-help at stat.math.ethz.ch.

Consider the following example of 10 numbers.  10% trimmed mean is correct
but you can see that the result is the same for many trimming fractions
till 0.20!

For example 13% trimmed mean should use interpolation of second and
eighth ordered observation.  R does not seem to do this.
The correct 13% trimmed mean is the average of 7.4 middle observations
(28+46+50+52+54+63+82+64.4)/7.4
Answer=(439.4)/7.4= 59.3784


> z=c(23, 40,     46,      50,      52,      54,    63,    82,92,98)
> mean(z, trim=0.10)
[1] 59.875
> mean(z, trim=0.13) # wrong result is  59.875
[1] 59.875
> mean(z, trim=0.15)
[1] 59.875
> mean(z, trim=0.18)
[1] 59.875
> mean(z, trim=0.1999999)
[1] 59.875
> mean(z, trim=0.20)
[1] 57.83333
> mean(z, trim=0.40)
[1] 53


Hrishikesh D. Vinod
Professor of Economics, Fordham University
E-Mail: Vinod at fordham.edu  Tel 718-817-4065,
Secretary 718-817-4048, Fax 718-817-3518
Web page:  http://www.fordham.edu/economics/vinod




More information about the R-help mailing list