scikit_posthocs.outliers_iqr
- scikit_posthocs.outliers_iqr(x: List | ndarray, ret: str = 'filtered', coef: float = 1.5) ndarray
Simple detection of potential outliers based on interquartile range (IQR). Data that lie within the lower and upper limits are considered non-outliers. The lower limit is the number that lies 1.5 IQRs below (coefficient may be changed with an argument, see Parameters) the first quartile; the upper limit is the number that lies 1.5 IQRs above the third quartile.
- Parameters:
x (Union[List, np.ndarray]) – An array, any object exposing the array interface, containing p values.
ret (str = 'filtered') –
Specifies object to be returned. Available options are:
filtered: return a filtered array (default)outliers: return outliersindices: return indices of non-outliersoutliers_indices: return indices of outliers
coef (float = 1.5) – Coefficient by which IQR is multiplied.
- Returns:
One of the following objects:
Filtered array (default) if
retis set tofiltered.Array with indices of elements lying within the specified limits if
retis set toindices.Array with outliers if
retis set tooutliers.Array with indices of outlier elements if
retis set tooutliers_indices.
- Return type:
numpy.ndarray
Examples
>>> x = np.array([4, 5, 6, 10, 12, 4, 3, 1, 2, 3, 23, 5, 3]) >>> outliers_iqr(x, ret = 'outliers') array([12, 23])