[EMAIL PROTECTED] wrote: > > > subject: trimmed mean in R seems to round the trimming fraction > to [EMAIL PROTECTED] > > 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 > >
Hi, The "trim" argument works as documented. Did you read ?mean: If 'trim' is non-zero, a symmetrically trimmed mean is computed with a fraction of 'trim' observations deleted from each end before the mean is computed. Also, I don't recall ever learning your method for trimmed mean, but R is a programming language and you can always write your own trimmed mean function. HTH, --sundar ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html