_r22#

pycafee.sample.outliers.Dixon._r22(self, x_exp, which)#

The equation to calculate the Dixon statsitic for the r22 ratio as described at [1]

Parameters
x_expnumpy array

One dimension numpy array with the data ordered.

whichstr

The value that should be evaluated.

  • If it is "max" (or None), the highest value is checked if it is a possible outlier.

  • If it is "min", the lowest value is checked.

Notes

If which=="min", the equation used is:

\[r_{22} = \frac{x_3-x_{1}}{x_{n-2}-x_1}\]

If which=="max", the equation used is:

\[r_{22} = \frac{x_n-x_{n-2}}{x_{n}-x_3}\]

References

1

DIXON, W. J. Processing Data for Outliers. Biometrics, v. 9, n. 1, p. 74–89, 1953.

Examples

>>> from pycafee.sample.dixon import Dixon
>>> import numpy as np
>>> x_exp = np.array([159, 153, 184, 153, 156, 150, 147])
>>> x_exp.sort(kind='quicksort')
>>> teste = Dixon()
>>> result = teste._r22(x_exp, which="min")
>>> print(result)
0.6666666666666666
>>> result = teste._r22(x_exp, which="max")
>>> print(result)
0.9032258064516129
>>> from pycafee.sample.dixon import Dixon
>>> 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')
>>> teste = Dixon()
>>> result = teste._r22(x_exp, which="min")
>>> print(result)
0.7142857142857089
>>> result = teste._r22(x_exp, which="max")
>>> print(result)
0.7499999999999944