_r12#
- pycafee.sample.outliers.Dixon._r12(self, x_exp, which)#
The equation to calculate the Dixon statsitic for the
r12ratio as described at [1]- Parameters
- x_exp
numpy array One dimension numpy array with the data ordered.
- which
str The value that should be evaluated.
If it is
"max"(orNone), the highest value is checked if it is a possible outlier.If it is
"min", the lowest value is checked.
- x_exp
Notes
If
which=="min", the equation used is:\[r_{12} = \frac{x_2-x_{1}}{x_{n-2}-x_1}\]If
which=="max", the equation used is:\[r_{12} = \frac{x_n-x_{n-1}}{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._r12(x_exp, which="min") >>> print(result) 0.3333333333333333 >>> result = teste._r12(x_exp, which="max") >>> print(result) 0.8064516129032258
>>> 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._r12(x_exp, which="min") >>> print(result) 0.6428571428571392 >>> result = teste._r12(x_exp, which="max") >>> print(result) 0.7499999999999944