scikit_posthocs.outliers_grubbs

scikit_posthocs.outliers_grubbs(x: Union[List[T], numpy.ndarray], hypo: bool = False, alpha: float = 0.05) → Union[numpy.ndarray, bool]

Grubbs’ Test for Outliers [1]. This is the two-sided version of the 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.
  • 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 an outlier (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[np.ndarray, bool]

Notes

[1]http://www.itl.nist.gov/div898/handbook/eda/section3/eda35h1.htm

Examples

>>> x = np.array([199.31,199.53,200.19,200.82,201.92,201.95,202.18,245.57])
>>> ph.outliers_grubbs(x)
array([ 199.31,  199.53,  200.19,  200.82,  201.92,  201.95,  202.18])