get_critical_value#

pycafee.sample.outliers.Grubbs.get_critical_value(self, n_rep, kind=None, alfa=None)#

This function returns the critical value for the Grubbs [1] test.

Parameters
n_repint

The total number of observations (3 <= n_rep <= 30, vary).

kindstr, optional

The type of the test.

  • If kind="one" (or None), the function returns the critical value for \(G^{'}\)

  • If kind="two", the function returns the critical value for \(G^{''}\)

  • If kind="three", the function returns the critical value for \(G^{'''}\)

alfafloat

The significance level (0.10, 0.05 (default) or 0.01)

Returns
resulttuple with:
criticalfloat

The critical value.

alfafloat

The corresponding significance level.

Notes

For \(G^{'}\) (kind="one") the critical values are limited for sample sizes between 3 and 30. For larger sample size, check [2]

For \(G^{''}\) (kind="two") the critical values are limited for sample sizes between 3 and 20. For larger sample size, check [3].

For \(G^{'''}\) (kind="three") the critical values are limited for sample sizes between 4 and 30. For larger sample size, check [2].

References

1

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

2(1,2)

GRUBBS, F. E.; BECK, G. Extension of Sample Sizes and Percentage Points for Significance Tests of Outlying Observations. Technometrics, v. 14, n. 4, p. 847–854, 1972.

3

DAVID, H. A.; HARTLEY, H. O.; PEARSON, E. S. The Distribution of the Ratio, in a Single Normal Sample, of Range to Standard Deviation. Biometrika, v. 41, n. 3/4, p. 482–493, 1954.

Examples

Getting the critical value for 5 samples at 5% significance level for \(G^{'}\)

>>> from pycafee.sample.outliers import Grubbs
>>> test = Grubbs()
>>> result = test.get_critical_value(5)
>>> print(result)
GrubbsResult(Critical=1.715, alpha=0.05)

Getting the critical value for 5 samples at 5% significance level for \(G^{''}\)

>>> from pycafee.sample.outliers import Grubbs
>>> test = Grubbs()
>>> result = test.get_critical_value(5, kind="two")
>>> print(result)
GrubbsResult(Critical=2.753, alpha=0.05)

Getting the critical value for 5 samples at 5% significance level for \(G^{'''}\)

>>> from pycafee.sample.outliers import Grubbs
>>> test = Grubbs()
>>> result = test.get_critical_value(5, kind="three")
>>> print(result)
GrubbsResult(Critical=0.009, alpha=0.05)