Skip to content

Outlier Detection

quartile_method(x, cu=2.5, ci=2.5, a=0)

Calculates a threshold using the quartile method.

Parameters:

Name Type Description Default
x array_like

The input data array to remove outliers from.

required
cu float

The upper cutoff for each element of x.

2.5
ci float

The lower cutoff for each element of x.

2.5
a int

A number between 0 and 1 giving the scale factor for the median to establish the minimum dispersion between quartiles for each element of x. The default does not set a minimum dispersion.

0

Returns:

Type Description
ndarray

A filtered data array

Source code in src/pyar/outlier_detection.py
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def quartile_method(
    x: npt.ArrayLike,
    cu: float = 2.5,
    ci: float = 2.5,
    a: int = 0,
) -> npt.ArrayLike:
    """Calculates a threshold using the quartile method.

    Parameters
    ----------
    x : array_like
        The input data array to remove outliers from.
    cu : float, default: 2.5
        The upper cutoff for each element of `x`.
    ci : float, default: 2.5
        The lower cutoff for each element of `x`.
    a : int, default: 0
        A number between 0 and 1 giving the scale factor for the
        median to establish the minimum dispersion between quartiles for each
        element of `x`. The default does not set a minimum dispersion.

    Returns
    -------
    ndarray
        A filtered data array

    """
    raise NotImplementedError