scikit_posthocs.outliers_tietjen

scikit_posthocs.outliers_tietjen(x: List | ndarray, k: int, hypo: bool = False, alpha: float = 0.05) ndarray | bool

Tietjen-Moore test [1] to detect multiple outliers in a univariate data set that follows an approximately normal distribution. The Tietjen-Moore test [2] is a generalization of the Grubbs’ test to the case of multiple outliers. If testing for a single outlier, the Tietjen-Moore test is equivalent to the Grubbs’ test.

The null hypothesis implies that there are no outliers in the data set.

Parameters:
  • x (Union[List, np.ndarray]) – An array, any object exposing the array interface, containing data to test for an outlier in.

  • k (int) – Number of potential outliers to test for. Function tests for outliers in both tails.

  • hypo (bool = False) –

    Specifies whether to return a bool value of a hypothesis test result. Returns True when we can reject the null hypothesis. Otherwise, False. Available options are:

    • True: return a hypothesis test result

    • False: return a filtered array without outliers (default).

  • alpha (float = 0.05) – Significance level for a hypothesis test.

Returns:

Returns a filtered array if alternative hypothesis is true, otherwise an unfiltered array. Returns null hypothesis test result instead of an array if hypo argument is set to True.

Return type:

Union[numpy.ndarray, bool]

Notes

Examples

>>> x = np.array([-1.40, -0.44, -0.30, -0.24, -0.22, -0.13, -0.05, 0.06,
0.10, 0.18, 0.20, 0.39, 0.48, 0.63, 1.01])
>>> outliers_tietjen(x, 2)
array([-0.44, -0.3 , -0.24, -0.22, -0.13, -0.05,  0.06,  0.1 ,  0.18,
0.2 ,  0.39,  0.48,  0.63])