_two#

pycafee.sample.outliers.Grubbs._two(self, x_exp)#

This function calculates the statistic for the Grubbs test to check if the sample has two outliers, in each at one end of the distribution (the lowest and highest value at the same time), as described by Grubbs [1] (\(G^{''}\))

Parameters
x_expnumpy array

One dimension numpy array with the data ordered.

Returns
statisticfloat

The test statistic

Notes

The equation used to estimate the Grubbs statistic for this case is the following:

\[G^{''} = \frac{x_n-x_1}{s}\]

The data must be ordered.

References

1

GRUBBS, F. E. Sample Criteria for Testing Outlying Observations. The Annals of Mathematical Statistics, v. 21, n. 1, p. 27–58, 1950.

Examples

>>> from pycafee.sample.outliers import Grubbs
>>> import numpy as np
>>> x_exp = np.array([159, 153, 184, 153, 156, 150, 147])
>>> x_exp.sort(kind='quicksort')
>>> test = Grubbs()
>>> result = test._two(x_exp)
>>> print(result)
2.99827968186036
>>> from pycafee.sample.outliers import Grubbs
>>> import numpy as np
>>> x_exp = np.array([15.42, 15.51, 15.52, 15.53, 15.68, 15.52, 15.56, 15.53, 15.54, 15.56])
>>> x_exp.sort(kind='quicksort')
>>> test = Grubbs()
>>> result = test._two(x_exp)
>>> print(result)
4.076568442994411