View source: R/ts_fil_winsor.R
| ts_fil_winsor | R Documentation |
Apply Winsorization to limit extreme values by replacing them with nearer order statistics, reducing the influence of outliers.
ts_fil_winsor()
A ts_fil_winsor object.
J. W. Tukey (1962). The future of data analysis. Annals of Mathematical Statistics. (Winsorization discussed in robust summaries.)
# Winsorization: cap extreme values to reduce outlier impact
# Load package and example data
library(daltoolbox)
data(tsd)
tsd$y[9] <- 2 * tsd$y[9] # inject an outlier
# Fit Winsor filter and transform series
filter <- ts_fil_winsor()
filter <- fit(filter, tsd$y)
y <- transform(filter, tsd$y)
# Plot original vs Winsorized series
plot_ts_pred(y = tsd$y, yadj = y)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.