Detect outlier values using IQR/quantile method#
- assesspy.is_outlier(x: list[int] | list[float] | Series, method: str = 'iqr', probs: tuple[float, float] = (0.05, 0.95), mult: float = 3.0) Series #
Detect outliers in numeric values using standard methods.
Certain assessment performance statistics are sensitive to extreme outliers. As such, it is often necessary to remove outliers before performing a sales ratio study.
The IAAO standard method is to remove outliers that are 3 * IQR. Warnings are thrown when sample size is extremely small or when the IQR is extremely narrow. See IAAO Standard on Ratio Studies Appendix B. Outlier Trimming Guidelines for more information.
- Parameters:
x (Array-like numeric values) – A list or
pd.Series
of numeric values, typically sales ratios. Must be longer than 2 and cannot containInf
orNaN
values.method (str) – Default
iqr
. String indicating outlier detection method. Options areiqr
orquantile
.probs (tuple[float]) – Upper and lower percentiles boundaries for the
quantile
method.mult (float) – Default
3
. Multiple of IQR to use as the outlier detection threshold.
- Returns:
A boolean
pd.Series
the same length asx
indicating whether or not each value ofx
is an outlier.- Return type:
pd.Series
- Example:
# Detect outliers: import assesspy as ap ap.is_outlier(ap.ccao_sample().estimate)