Winsorize: Winsorized Mean

Description Usage Arguments Details Value Note References

Description

Compute the winsorized mean, which consists of recoding the top k values of a vector.

Usage

1
Winsorize(x, k = 1, na.rm = TRUE)

Arguments

x

The vector to be winsorized

k

An integer for the quantity of outlier elements that to be replaced in the calculation process

na.rm

a logical value for na.rm, default is na.rm=TRUE.

Details

Winsorizing a vector will produce different results than trimming it. While trimming a vector causes the extreme values to be discarded, winsorizing causes the extreme values to be replaced by certain percentiles.

Value

An object of the same type as x

Note

One may want to winsorize estimators, however, winsorization tends to be used for one-variable situations.

@author Daniel Marcelino, dmarcelino@live.com

@examples set.seed(51) # for reproducibility x <- rnorm(50) ## introduce outlier x[1] <- x[1] * 10

# Compare to mean: mean(x) Winsorize(x)

References

Dixon, W. J., and Yuen, K. K. (1999) Trimming and winsorization: A review. The American Statistician, 53(3), 267–269. @references Wilcox, R. R. (2012) Introduction to robust estimation and hypothesis testing. Academic Press, 30-32. Statistics Canada (2010) Survey Methods and Practices.


danielmarcelino/SciencesPo documentation built on Oct. 20, 2019, 1:15 a.m.