Notes

Interquartile Range (IQR) Method

A simple way to spot suspicious data points is to ask: what counts as "far away" from the middle of the data? The Interquartile Range (IQR) Method answers that using the spread of the middle 50% of values, which makes it much less sensitive to extreme points than methods based on the mean and standard deviation.

How it works

The method starts with two quartiles:

  • Q1: the 25th percentile
  • Q3: the 75th percentile

The interquartile range is IQR = Q3 - Q1. This measures the width of the central half of the data. A common rule marks a value as an outlier if it falls below Q1 - 1.5 × IQR or above Q3 + 1.5 × IQR. For more extreme anomalies, people use 3 × IQR. Because the cutoff is built from percentiles rather than averages, a few huge or tiny values do not distort it much.

Why it matters in unsupervised learning

In anomaly detection, there are no labels telling you what is normal or abnormal. The IQR Method gives a fast, interpretable baseline for finding unusual observations in a single feature. It is useful in early data cleaning and exploratory analysis, especially for things like:

  • unusually large transaction amounts
  • abnormal sensor readings from equipment
  • customers with unusually high purchase frequency
Practical limits and usage

The method works best for univariate analysis. It does not capture strange combinations across multiple features, so it will miss anomalies that only look unusual jointly. It also becomes less reliable for heavily skewed or multimodal data unless features are transformed or analyzed separately by group. In practice, analysts compute it with tools like pandas quantiles or boxplots, and use it as a transparent first pass before moving to methods like Isolation Forest or Local Outlier Factor.

Interquartile Range (IQR) Method is a statistical outlier-detection rule that flags observations lying below Q1 − 1.5×IQR or above Q3 + 1.5×IQR, where IQR = Q3 − Q1. Because it relies on the middle 50% of the data, it is resistant to extreme values and works well for identifying unusually low or high points without labels. It matters because it provides a simple, robust baseline for anomaly detection and data cleaning.

Think of a class test where most scores fall in the middle, but one student gets 2 and another gets 100. The Interquartile Range (IQR) Method is a simple way to spot values that seem unusually far from where most of the data sits.

It looks at the “middle spread” of the data — the range where the central half of values lives — and uses that as a sense of what counts as normal. Anything much lower or higher than that gets flagged as a possible outlier, meaning something unusual or worth checking.

In AI and anomaly detection, this helps find strange transactions, faulty sensor readings, or rare events without needing labeled examples first.