Learn R Programming

correlation (version 0.6.1)

winsorize: Winsorize data

Description

Winsorizing or winsorization is the transformation of statistics by limiting extreme values in the statistical data to reduce the effect of possibly spurious outliers. The distribution of many statistics can be heavily influenced by outliers. A typical strategy is to set all outliers (values beyond a certain threshold) to a specified percentile of the data; for example, a 90% winsorization would see all data below the 5th percentile set to the 5th percentile, and data above the 95th percentile set to the 95th percentile. Winsorized estimators are usually more robust to outliers than their more standard forms.

Usage

winsorize(data, ...)

# S3 method for numeric winsorize(data, threshold = 0.2, verbose = TRUE, ...)

Arguments

data

Dataframe or vector.

...

Currently not used.

threshold

The amount of winsorization.

verbose

Toggle warnings.

Examples

Run this code
# NOT RUN {
library(correlation)

winsorize(iris$Sepal.Length, threshold = 0.2)
winsorize(iris, threshold = 0.2)
# }

Run the code above in your browser using DataLab