<< ST_esd Outlier-Tests ST_grubbs_iterat >>

samplestat >> samplestat > Outlier-Tests > ST_grubbs

ST_grubbs

Classical non-iterative Grubbs test for a single outlier

Syntax

[outlierfree, outlier] = ST_grubbs(v, p)
[outlierfree, outlier] = ST_grubbs(v, p, side)
outlierfree = ST_grubbs(v, p)
outlierfree = ST_grubbs(v, p, side)

Parameters

v :

real vector of numerical sample values; at least three values are required

p :

statistical confidence level as a string or significance level α as a decimal value "95%", "99%", "99.9%", 0.05, 0.01 or 0.001

side :

test direction, "both" (default), "left" or "right"

outlierfree :

input vector with the detected outlier removed; unchanged if the test does not identify an outlier

outlier :

detected outlier as a scalar vector; [] if no outlier is detected

Description

ST_grubbs performs the classical, non-iterative Grubbs test and can detect at most one outlier in a sample. The test is performed exactly once on the complete input vector. It is therefore not affected by the changing critical limits and accumulated type-I error associated with repeated application.

The test assumes that the observations are independent and approximately normally distributed. A minimum sample size of n >= 3 is required. The test has limited power for very small samples, and a non-significant result must not be interpreted as proof that the sample contains no outlier.

Test directions:

"both" tests the observation with the largest absolute deviation from the sample mean. The critical probability uses α/(2*n).

"left" tests only the minimum observation. The critical probability uses α/n.

"right" tests only the maximum observation. The critical probability uses α/n.

The sample standard deviation is calculated with denominator n-1. If all sample values are identical, the standard deviation is zero and no outlier is returned.

Test statistic

\begin{eqnarray}
G_{two-sided} &=& \frac{\max_i |x_i-\overline{x}|}{s} \\
G_{left} &=& \frac{\overline{x}-x_{min}}{s} \\
G_{right} &=& \frac{x_{max}-\overline{x}}{s}
\end{eqnarray}

Critical value

\begin{eqnarray}
G_{crit} &=& \frac{n-1}{\sqrt{n}}
\sqrt{\frac{t^2}{n-2+t^2}} \\
t &=& t_{1-\alpha/(2n),\,n-2}\quad\text{Student t quantile for a two-sided test} \\
t &=& t_{1-\alpha/n,\,n-2}\quad\text{Student t quantile for a one-sided test} \\
\text{with} \\
x_i     &:& \text{test value} \\
n       &:& \text{number of values} \\
s       &:& \text{sample standard deviation} \\
\bar{x} &:& \text{arithmetic mean} \\
x_{max} &:& \text{max. value} \\
x_{min} &:& \text{min value} \\
\alpha  &:& \text{statistical confidence level}
\end{eqnarray}

Decision rule

The selected observation is classified as an outlier when G > Gcrit. Equality does not lead to rejection.

Examples

data = [0.4827129 0.3431706 -0.4127328 0.3843994 ..
-0.7107495 -0.2547306 0.0290803 0.1386087 ..
-0.7698385 1.0743628 1.0945652 0.4365680 ..
-0.5913411 -0.7426987 1.609719 0.8079680 ..
-2.1700554 -4.7361261 0.0069708 14.626386 ..
-2.5036545 -2.9046385];

// Two-sided test at 95% confidence
[of, o] = ST_grubbs(data, "95%")
[of, o] = ST_grubbs(data, 0.05, "both")

// Test only the minimum at 99% confidence
[of, o] = ST_grubbs(data, "99%", "left")

// Test only the maximum at 99.9% confidence
[of, o] = ST_grubbs(data, 0.001, "right")

See also

Authors

Bibliography

Grubbs, F. E. (1950). Sample criteria for testing outlying observations. Annals of Mathematical Statistics, 21(1), 27-58.

Grubbs, F. E. (1969). Procedures for detecting outlying observations in samples. Technometrics, 11(1), 1-21.

NIST/SEMATECH e-Handbook of Statistical Methods, Grubbs' Test for Outliers.


Report an issue
<< ST_esd Outlier-Tests ST_grubbs_iterat >>