Learn R Programming

SciencesPo (version 0.11.21)

winsor.mean: Winsorized Mean

Description

This function computes the winsorized mean. The winsorization approach consists of recoding the top k values.

Usage

winsor.mean(x, k = 1, na.rm = TRUE)

Arguments

x
is the vector to be winsorized.
k
is an integer for the quantity of outlier elements that should be replaced to the computation purpose.
na.rm
A logical value indicating whether NA values should be stripped before the computations.

Value

  • An object of the same type as x.

encoding

UTF-8

Details

Winsorizing a vector will produce different results than trimming it. By trimming a vector, the extreme values are discarded, while by winsorizing it the extreme values are replaced by certain percentiles.

References

Dixon, W. J., and Yuen, K. K. (1999) Trimming and winsorization: A review. The American Statistician, 53(3), 267--269.

Dixon, W. J., and Yuen, K. K. (1960) Simplified Estimation from Censored Normal Samples, The Annals of Mathematical Statistics, 31, 385--391.

Wilcox, R. R. (2012) Introduction to robust estimation and hypothesis testing. Academic Press, 30-32.

Statistics Canada (2010) Survey Methods and Practices.

See Also

detail.

Examples

Run this code
x <- rnorm(100)

winsor.mean(x)

# see this function in context. 
detail(x)

Run the code above in your browser using DataLab