Exercise

Handle outliers with standard deviation

Given a basetable that has one variable "age". The age is manually filled out in an online form by the donor and is therefore prone to typing errors and can have outliers. Replace all values that are lower than the mean age minus 3 times the standard deviation of age by this value, and replace all values that are higher than the mean age plus 3 times the standard deviation of age by this value.

Instructions

100 XP
  • Print the maximum value of "age".
  • Calculate the mean and standard deviation of "age".
  • Calculate the lower and upper limits using the standard deviation rule of thumb.
  • Add a variable "age_mod" to the basetable with outliers replaced, and print the new maximum value of "age _mod".