The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



GrubbsTest


Unit: SDL_statis
Class: none
Declaration: [1] function GrubbsTest (Data: TVector; SigLevel: double; var Statistic: double; var Outlier: integer): integer;
[2] function GrubbsTest (Data: TDoubleArray; SigLevel: double; var Statistic: double; var Outlier: integer): integer;

The function GrubbsTest performs a Grubbs outlier test on the data contained in Data. The parameter SigLevel specifies the level of significance. On return the variable parameter Outlier provides the index of the element of the vector Data which is considered to be an outlier. If no outliers are recognized, Outlier is set to -1. The variable parameter Statistic contains the corresponding test statistic.

The function returns the following error codes:

 0 ... everything is OK, the value of Outlier is valid
-1 ... invalid level of significance
-2 ... too few data values (a minimum of 4 data points is required)

 

Hint 1: Note that this function tests only for a single outlier, checking both the lowest and the highest value in the Data array/vector. The element which delivers the highest test statistic is compared to the critical value.

Hint 2: Please keep in mind that the data vector in version [1] is 1-based, while the data array of version [2] is 0-based. The parameter Outlier reflects this fact. In the case of version [1] the valid range of Outlier is from 1 to Data.NrofElem, while in the case of version [2] the valid range is from 0 to length(Data)-1.



Last Update: 2023-Feb-06