Calculate the interquartile range (Q3 − Q1) as a robust measure of spread.
The interquartile range (IQR) is Q3 minus Q1. It measures the spread of the middle 50% of data and is resistant to outliers, unlike the full range.
IQR = Q3 − Q1
IQR ignores the extreme values and only measures the spread of the middle half of the data, making it robust against outliers.
Values below Q1 − 1.5×IQR or above Q3 + 1.5×IQR are flagged as outliers using Tukey's fence method.