pqc.detect.robust_outliers

Robust outlier detection using median/MAD standardized residuals.

This detector computes robust z-scores using the median and median absolute deviation (MAD), then flags points exceeding a configurable threshold.

Notes

Definition

\(\mathrm{MAD}=\mathrm{median}(|y_i-\mathrm{median}(y)|)\). Robust z-score is approximated as \(z_i = 0.6745 (y_i-\mathrm{median}(y))/\mathrm{MAD}\).

Why used here

Median/MAD is resilient to contamination and provides a lightweight fallback detector when distribution tails are uncertain.

Assumptions
  • Majority of points are not gross outliers.

  • Central tendency is reasonably represented by median.

Caveats

MAD can be zero for low-variance or quantized series, in which case no robust outlier is reported.

References

Functions

detect_robust_outliers(df, *[, resid_col, ...])

Flag robust outliers using median/MAD standardized scores.