On 27 July 2016 at 22:42, Milan Bouchet-Valat <[email protected]> wrote:

> > Is there any chance that the definition of trimmean() could be
> > changed in a future release to agree with Wilcox (2010) and other
> > texts?
> I guess so, in particular if you confirm that other major software
> behaves that way, and even more so if you make a PR.
>


Ok. I've done that now. I can confirm that R does the trimmed mean the way
I described:

> help(mean)
...
    trim: the fraction (0 to 0.5) of observations to be trimmed from
          each end of ‘x’ before the mean is computed.  Values of trim
          outside that range are taken as the nearest endpoint.
...
> x = c(1, 10,20,30,40,50,60,70,80, 10000)
>
> mean(x, trim=0.25)
[1] 45
> mean(x, trim=0.05)
[1] 1036.1


Compared with:

julia> using StatsBase
julia> x = [1, 10,20,30,40,50,60,70,80, 10000]
julia> trimmean(x,0.5)
40.0
julia> trimmean(x,0.1)
40.111111111111114


I also made a PR that makes trimmean() behave the same way as the R
implementation, and the way Wilcox (2010) says it should behave. I don't
have a lot of experience making PRs. I hope I got it right:


https://github.com/JuliaStats/StatsBase.jl/pull/199


Cheers,
Daniel.

-- 
You received this message because you are subscribed to the Google Groups 
"julia-stats" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to