ggplot2-solutions
ggplot2-solutions copied to clipboard
Exercise 10.3.2 #2 Trans to detect outliers
The exercise is to know:
What transformation makes it easier to extract outliers?
https://github.com/kangnade/ggplot2-solutions/blob/e6ef9e3b271599f6e97afc0f8a3f012f276f9385/ggplot2_solutions_chapter10.Rmd#L188
I believe using the square root transformation can help identify extreme outliers first:
ggplot(diamonds, aes(x,z)) +
stat_bin2d() +
scale_y_sqrt() + scale_x_sqrt()
Then, the log10 transformation may be used for less distant outliers:
ggplot(diamonds, aes(x,z)) +
stat_bin2d() +
scale_y_log10() + scale_x_log10()
Warmly