# Robust Statistics

StatsBase.trimFunction
trim(x::AbstractVector; prop=0.0, count=0)

Return an iterator of all elements of x that omits either count or proportion prop of the highest and lowest elements.

The number of trimmed elements could be smaller than specified if several elements equal the lower or upper bound.

To compute the trimmed mean of x use mean(trim(x)); to compute the variance use trimvar(x) (see trimvar).

Example

julia> collect(trim([5,2,4,3,1], prop=0.2))
3-element Array{Int64,1}:
2
4
3
StatsBase.winsorFunction
winsor(x::AbstractVector; prop=0.0, count=0)

Return an iterator of all elements of x that replaces either count or proportion prop of the highest elements with the previous-highest element and an equal number of the lowest elements with the next-lowest element.

The number of replaced elements could be smaller than specified if several elements equal the lower or upper bound.

To compute the Winsorized mean of x use mean(winsor(x)).

Example

julia> collect(winsor([5,2,3,4,1], prop=0.2))
5-element Array{Int64,1}:
4
2
3
4
2
StatsBase.trimvarFunction
trimvar(x; prop=0.0, count=0)

Compute the variance of the trimmed mean of x. This function uses the Winsorized variance, as described in Wilcox (2010).