Price Anomaly Detection Using the Interquartile Range (IQR) is a statistical filtering method used by data pipelines to stop Trade-Based Money Laundering (TBML) and tax evasion. By grouping trade data by Harmonized System (HS) codes, the pipeline establishes a realistic market price range and flags transactions that fall outside normal boundaries.
 
1. The Core Objective
The framework automatically isolates manipulation in product pricing, protecting organizations from participating in illegal financial transfers:
  • Detect Under-Invoicing: Catch imports priced abnormally low, which is often used to evade customs duties or smuggle capital into a country. 
  • Detect Over-Invoicing: Identify exports priced abnormally high, a common method used to disguise the illicit transfer of large sums of cash across borders.
  • Eliminate Human Bias: Replace arbitrary price caps with dynamic, data-driven thresholds that automatically adjust to market fluctuations. 
2. The Mathematical Framework
The statistical pipeline analyzes historical unit prices for a specific product code and calculates three core metrics
 
Interquartile Range (IQR):
         IQR = Q3 – Q1
 
Upper Anomalous Limit:
Upper Anomalous Limit = Q3 + 1.5 times IQR                
Lower Anomalous Limit:
Lower Anomalous Limit = Q1 – 1.5 times IQR 
         
2. Definition of Core Metrics
  • Q1 (First Quartile): The 25th percentile of historical prices. 25% of all shipments are priced at or below this value.
  • Q3 (Third Quartile): The 75th percentile of historical prices. 75% of all shipments are priced at or below this value.
  • IQR (Interquartile Range): The middle 50% of the price distribution, measuring price volatility for that specific good.
3. Price Distribution and Anomaly Boundaries
 

Any transaction with a unit price higher than the Upper Anomalous Limit or lower than the Lower Anomalous Limit is isolated as a pricing anomaly.
 
4. Implementation Checklist for Data Engineers
  • Segment Data by HS Code: Always calculate distinct quartiles for each specific product classification to avoid mixing unrelated product prices.
  • Apply Temporal Windows: Refresh the historical baseline quarterly or monthly to account for natural inflation and raw material price changes.
  • Filter Out Extreme Noise: Apply an initial filter to remove obvious data entry errors (like a price of zero) before calculating quartiles.
  • Log the Deviation Score: Record how far an anomalous transaction sits outside the limit to help analysts prioritize the highest-risk alerts.
 
Â