Detecting Outliers: Statistical Methods
What you'll learn: How to identify data points that deviate unusually far from the typical pattern using simple statistical thresholds.
The Core Idea
Outliers are extreme values that don't fit the general pattern of your data. Think of them like a basketball player in a group photo of kindergarteners—they stick out! Before building models, you need to detect these unusual points because they can skew your results or signal important anomalies.
Statistical methods give you numeric thresholds to flag these oddballs automatically.
Three Key Statistical Methods
Z-Score Method
A z-score tells you how many standard deviations a point is from the mean. If your data point has a z-score beyond ±3 (or sometimes ±2), it's typically considered an outlier. It's like asking: "How weird is this compared to normal?"
Formula: z = (x - mean) / standard_deviation
Interquartile Range (IQR) Method
This method uses the middle 50% of your data (between the 25th and 75th percentiles). Any point below Q1 - 1.5×IQR or above Q3 + 1.5×IQR is flagged. This approach is more robust to existing outliers than z-scores because it doesn't use the mean.
Modified Z-Score
Similar to the standard z-score, but uses the median instead of the mean and median absolute deviation (MAD) instead of standard deviation. This makes it resistant to outliers influencing the detection itself—like using a neutral judge instead of one who might be biased by extreme cases.
Key Takeaway: Statistical outlier detection uses z-scores (distance from mean), IQR (fence around the middle data), or modified z-scores (robust median-based distance) to automatically flag unusual univariate data points based on how far they deviate from typical values.