Winsorization treats extreme observations by replacing them with boundary values instead of deleting them. This preserves the dataset’s length while reducing the influence that outliers can exert on regression results. section 5.4 section 20.4
A practical winsorization workflow is:
- Inspect distributions with scatterplots, histograms, and boxplots; use boxplots to make outlier identification and boundary selection less subjective. section 5.4.1
- Replace values beyond a boxplot whisker with the whisker endpoint rather than removing observations. section 5.4.1
- Check the revised distribution and confirm the new extreme value with a summary statistic. section 5.4.1
Capping extreme deflections
The hustle dataset contained two unusually high deflections, with an original maximum of 18.70. Replacing every value above 17.8 with 17.8 preserved all 90 rows, changed the maximum to 17.8, and produced a boxplot without outliers. section 5.4.1
sp1 <- qplot(seq_along(hustle$deflections), hustle$deflections) +
labs(title = "Deflections",
subtitle = "scatterplot",
x = "",
y = "Value") +
theme(plot.title = element_text(face = "bold")) +
annotate("text", x = 65, y = 18.5,
label = "Outlier?", color = "red",
size = 3, fontface = "bold") +
annotate("text", x = 85, y = 18.3,
label = "Outlier?", color = "red",
size = 3, fontface = "bold")
hist1 <- ggplot(hustle, aes(x = deflections)) +
geom_histogram(fill = "snow1", color = "dodgerblue4", bins = 8) +
labs(title ="Deflections",
subtitle = "histogram",
x = "",
y = "Frequency") +
theme(plot.title = element_text(face = "bold")) +
annotate("text", x = 18.75, y = 3,
label = " Outliers?", color = "red",
size = 3, fontface = "bold")
bp1 <- ggplot(hustle, aes(x = "", y = deflections)) +
labs(title = "Deflections",
subtitle = "boxplot",
x = "",
y = "") +
geom_boxplot(color = "dodgerblue4", fill = "snow1", width = 0.5) +
stat_summary(fun = mean, geom = "point", shape = 20, size = 8,
color = "dodgerblue4", fill = "dodgerblue4") +
annotate("text", x = "", y = 18.6,
label = " Outliers",
color = "red", size = 3, fontface = "bold") +
theme(plot.title = element_text(face = "bold"))
Compare the scatterplot, histogram, and boxplot used to locate extreme deflections before capping them. section 5.4.1

