Get the data (Sulfate Concentrations from Savannah River (South Carolina) in mg / L)) from here and read it into R:
So we have a data.frame with one variable and 21 observations:
Winsorization replaces extreme data values with less extreme values. I have written a small function to run the winsorisation:
The function takes a ordered vector and replaces the 2 highest and 2 lowest values (can be changed by the ‘width’-Argument by their neighbors.
We can apply this function to our data and safe it as new column:
Worked as expected.
The Winsorized mean and standard-deviation is:
For the Winsorized Standard Deviation we need again a homemade function:
And lastly we calculate the mean for the trimmed data (remove two observation from each tail):
Code and data are available at my github-repo under filename ‘p33’.