Detect outlier values in a vector using IQR/quantile method#

assesspy.is_outlier(x, method='iqr', probs=[0.05, 0.95])#

Detect outliers in a numeric vector 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.

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 (numeric) – A numeric vector. Must be longer than 2 and not contain Inf or NaN.

  • method (str) – Default “iqr”. String indicating outlier detection method. Options are iqr or quantile.

  • probs (list[numeric]) – Upper and lower percentiles denoting outlier boundaries.

Returns:

A logical vector this same length as x indicating whether or not each value of x is an outlier.

Return type:

list[bool]

Example:

# Detect outliers:
import assesspy as ap

ap.is_outlier(ap.ratios_sample().ratio)