Sunday, November 7, 2010

1. Introduction

1.1  Purpose of this blog  variantie-uitbijter-test   variantie-uitschieter-test 
February 2010, I published a variance outlier test, which I called the "G test", in Analytica Chimica Acta.  This journal is well appreciated by analytical chemists.  However, the G test is relevant to other disciplines as well.  The G test is an extension of Cochran's C test [23] and is of potential interest to anyone who needs to decide if one or more variance (or standard deviation) estimates are extreme in comparison with a group with which they are supposed to be comparable.  I am aiming for a broader audience by posting a personal manuscript version of my article in this blog.  The publisher of the original article [33] allows such practice provided that the posting includes a link to the article's Digital Object Identifier (DOI) as well as a complete citation for the original article [34].  Please find the link and the citation immediately below:

        doi:10.1016/j.aca.2009.11.032                               R.U.E. 't Lam, Analytica Chimica Acta 659 (2010) 68–84.

Alternatively, you may visit my manuscript.  In the manuscript I have corrected some errata and inconsistencies. I also have extended the appendices of the original article to supply critical values for a broader selection of designs. Besides, I have added explanatory notes on performing a G test as Chapters 2 to 4 of the Home page. In priciple, a blog is not intended to be permanent. For reference purposes you are therefore advised to include a citation of my original article. If you have questions, suggestions or concerns regarding the original article, the blog or the G test in general, you are encouraged to leave me a message, contact me at rtlam@zeelandnet.nl or contact me through my page at LinkedIn.

1.2  Abstract
The abstract of the article in Analytica Chimica Acta [34] reads:
ISO Standard 5725 “Accuracy (trueness and precision) of measurement methods and results” recommends Cochran’s C test to numerically verify if three or more normally distributed data sets show “homogeneity of variances” or “homoscedasticity”. The C test is a one-sided outlier test that will identify deviant standard deviations. It can be run on summary data using a pocket calculator. However, the C test has limitations. It only applies to data sets of equal size. It uses critical values that are only available for the upper tail of the variance distribution, at selected numbers of data sets, selected numbers of replicates per set and only at two significance levels. Cochran’s C test will not identify an outlying low variance, but may mistake a high variance for an outlier instead. We transform the C test into a more general “G test”.
Expressions are derived to calculate upper limit as well as lower limit critical values for data sets of equal and unequal size at any significance level. The expressions are validated against literature values and through simulations in Excel. Representative critical values are tabulated for those who prefer to work from tables. The power of the G test is verified for data sets of equal and unequal size. The G test appears superior to the C test in detecting effects from low variances. The G test allows positive identification of exceptionally low variances. The application of the G test is illustrated with a numerical example.

1.3  Errata
1. In § 3.3 equation (18) was corrected to read:
        "ζLL(1) = 1 − ζUL(1) = 1 α1/L" in stead of "ζLL(1) = 1 − ζUL(1) = (1 α1)/L"
2. In § 3.5 the order of equations (30) and (31) was reversed to match the remainder of the manuscript.
3. Some typo's and rounding errors in Tables 6-8 were corrected.  
4. The lower left corner of Table 8 was changed to read "L= 6", instead of "L= 7".

1.4  Application Areas
Variance outlier testing is routinely applied in interlaboratory studies for determining the precision of analytical test methods according to ISO 5725.  However, variance outlier testing is also practiced outside (analytical) chemistry.  A search in Google Scholar on "Cochran's C test" + additional keyword, resulted in the numbers of hits listed below.  Key words with less than ten hits are not shown.  

As Cochran's C test is fully comprised in the G test, the G test is at least as widely applicable as Cochran's C test. Wikipedia provides a short background article on Cochran's C test [36].





Saturday, November 6, 2010

2. General summary of G test

2.1  Calculating a G ratio
The G test evaluates the ratio:
2.2  Conducting a G test
The G test can be run as a one-sided test upper-limit test, as a one-sided lower-limit test and as a two-sided test at any significance level α.  When running a G test, it is checked for each data set j if the corresponding inequality is met:
   One-sided upper limit test:    Gj < GUL(α,νjtotal,L)
   One-sided lower limit test:    GLL(α,νjtotal,L) < Gj
   Two-sided test:                    GLL(α/2,νjtotal,L) < Gj < GUL(α/2,νjtotal,L)


2.3  Computing critical G values
The critical G values GUL and GLL are calculated from:

The equations to calculate GUL and GLL are exact.  The accuracy of GUL and GLL only depends on the accuracy of the input value FcFc can be read from tables, but can also be obtained using the FINV function in Excel: Fc = FINV(probability, degrees of freedom 1, degrees of freedom 2).

2.4  Evaluating balanced and unbalanced designs
The G test can handle both balanced and unbalanced designs.  In case of balanced designs, all data sets have the same number of degrees of freedom.  Balanced designs are covered in § 3, unbalanced designs in § 4. 


3. Balanced designs

3.1  Cochran's C ratio
In a balanced design, all data sets have the same number of observations.  The G ratio (General summary of G test: § 2.1) then reduces to the well-known Cochran's C ratio [23]:
Where:
Gj = G test statistic for data set j
Cj = Cochran's C test statistic for data set j

3.2 Computing critical C values
For balanced designs the critical values CUL and  CLL take the reduced forms:
Fc is available in Excel: Fc = FINV(probability, degrees of freedom 1, degrees of freedom 2)

Below you find a simple example spreadsheet to calculate critical values for balanced designs:








Cell contents:

B11:  "=1/(1+(B5-1)/FINV(1-B4/B5,B6-1,(B5-1)*(B6-1)))"
B12:  "=1/(1+(B5-1)/FINV(1-B4/2/B5,B6-1,(B5-1)*(B6-1)))"
C10:  "=1/(1+(B5-1)/FINV(B4/B5,B6-1,(B5-1)*(B6-1)))"
C12:  "=1/(1+(B5-1)/FINV(B4/2/B5,B6-1,(B5-1)*(B6-1)))"


Current practitioners of Cochran's test may prefer to continue working from tables. For their convenience, Appendices A to F provide extensive lists with critical values for balanced designs:

Appendix
Limit
ζ
One-sided α
Two-sided α
A
Upper Limit
0.01
0.01
0.02
B
Upper Limit
0.025
0.025
0.05
C
Upper Limit
0.05
0.05
0.1
D
Lower Limit
0.01
0.01
0.02
E
Lower Limit
0.025
0.025
0.05
F
Lower Limit
0.05
0.05
0.1


3.3  One-sided upper limit G test
When conducting a one-sided upper limit G test on balanced data, it is not necessary to evaluate Gj for all data sets j.  It is sufficient to evaluate:
Where:
   Gmax = G test statistic for the data set with the highest variance  
   Cmax = Cochran's C test statistic for the data set with the highest variance

Running a one-sided upper limit G test on balanced data is similar to running a traditional Cochran's C test: 

Determine the upper limit value CUL according to § 3.2. If Gmax exceeds CUL, label the corresponding variance value as "exceptionally large", remove the value from the variance data, and repeat the test on the remaining variance values. Continue the process until you have identified all remaining variance outliers.

Several text books [1,2,6] and ISO 5725 [19] provide guidance on conducting a C test.  The main advantages of conducting a G test in stead are:
  1. The G test is not restricted to the significance levels α = 0.01 and α = 0.05 but will run at any significance level.
  2. The upper limit values for the G test need not be obtained from tables, but can be computed (§ 3.2). 
  3. The limit values for Cochran's C test have only been tabulated for selected numbers of data sets (L) and selected numbers of observations (n) per data set; whereas the G test allows limit values to be calculated for any combination of L and n.
3.4  One-sided lower limit G test
When conducting a one-sided lower limit G test on balanced data, it is not necessary to evaluate Gj for all data sets j.  It is sufficient to evaluate:
Where:
  Gmin = G test statistic for the data set with the lowest variance

Cochran's C test does not allow for lower limit tests. A one-sided lower limit G test on balanced data is conducted as follows:  

Determine the lower limit value CLL according to § 3.2. If Gmin is less than CLL, label the corresponding variance value as "exceptionally small", remove the value from the variance data, and repeat the test on the remaining variance values. Continue the process until you have identified all remaining variance outliers.

3.5  Two-sided G test
When conducting a two-sided G test on balanced data, it is not necessary to evaluate Gj for all data sets j.  It is sufficient to evaluate:

Where:
   Gmax = G test statistic for the data set with the highest variance  
   Gmin = G test statistic for the data set with the lowest variance  

Usually a two-sided G test on balanced data can be conducted as follows: 

Determine the upper limit value CUL and the lower limit value CLL according to § 3.2, taking ζ = α/2. If Gmax exceeds CUL, label the highest variance value as "deviant" and remove this value from the variance data.  Likewise,  if Gmin is less than CLL, label the lowest variance value as "deviant", remove that value from the variance data, and repeat the test on the remaining variance values. Continue the process continues until you have identified all remaining variance outliers.

Occasionally both the highest variance and the lowest variance value may appear "deviant".  In that case you should only remove the variance value that has the highest probability to be deviant indeed, and continue the process from there. There are two equivalent ways to identify the variance value that is most likely to be deviant. Conceptually the simplest approach is: 

Lower the initial significance level of the two-sided test such that only one of the variance values will still be marked "deviant".   Remove only that value from the variance data, and repeat the test at the lower significance level on the remaining variance values. Continue the process until you have identified and removed all variance outliers at the lower significance level. Then run the two-sided test on the remaining variance data; let the significance level gradually increase until you reach your initial significance level.

While conceptually simple, the above approach has the drawback that it will require more calculation work than is strictly necessary.  If you plan to apply the G test routinely, you may prefer to directly calculate the probability that a specific variance is truly deviant according to § 3.6 of the manuscript.

4. Unbalanced designs

The approaches described below are conceptually simplest, but require more calculation work than necessary.  If you plan to apply the G test routinely, you are referred to § 3.6 of the manuscript.

4.1       One-sided upper limit G test

For each data set j, calculate the ratio Gj according to § 2.1.  For each data set j, also calculate the upper limit critical value GUL at the desired significance level α according to § 2.3, and check if Gj ≤ GUL. 

  1. If Gj ≤ GUL for all data sets, there is no reason to assume that one of the data sets has an exceptionally large variance value in comparison with the other data sets.
  2. If Gj > GUL for one data set, label the corresponding variance value as "exceptionally large", remove the value from the variance data, and repeat the test on the remaining variance values.
  3. If Gj > GUL for several data sets, lower the significance level of the test until only one of the data sets still will show Gj > GUL.  Label the corresponding variance value as "exceptionally large", remove the value from the variance data, and repeat the test on the remaining variance values at the lowered significance level.  Continue the process until you have identified and removed all deviant data sets at the lowered significance level.  Then run the test on the remaining variance data; let the significance level gradually increase until you reach your initial significance level.
4.2       One-sided lower limit G test

For each data set j, calculate the ratio Gj according to § 2.1.  For each data set j, also calculate the lower limit critical value GLL at the desired significance level α according to § 2.3, and check if Gj ≥ GLL. 
  1. If Gj ≥ GLL for all data sets, there is no reason to assume that one of the data sets has an  exceptionally small variance value in comparison with the other data sets.
  2. If Gj < GLL for one data set, label the corresponding variance value as "exceptionally small", remove the value from the variance data, and repeat the test on the remaining variance values.
  3. If Gj < GLL for several data sets, lower the significance level of the test until only one of the data sets still will show Gj < GLL.  Label the corresponding variance value as "exceptionally small", remove the value from the variance data, and repeat the test on the remaining variance values at the lowered significance level.  Continue the process until you have identified and removed all deviant data sets at the lowered significance level.  Then run the test on the remaining variance data; let the significance level gradually increase until you reach your initial significance level.
4.3       Two-sided G test

For each data set j, calculate the ratio Gj according to § 2.1.  For each data set j, also calculate the upper limit critical value GUL and the lower limit critical value GLL at the desired significance level α according to § 2.3, and check if GLL ≤ Gj ≤ GUL. 

  1. If GLL ≤ Gj ≤ GUL for all data sets, there is no reason to assume that one of the data sets has a  deviant variance value in comparison with the other data sets.
  2. If GLL ≤ Gj ≤ GUL is not met for one particular data set, label the corresponding variance value as "deviant", remove the value from the variance data, and repeat the test on the remaining variance values.
  3. If GLL ≤ Gj ≤ GUL is not met for several data sets, lower the significance level of the test until only one of the data sets still will fail GLL ≤ Gj ≤ GUL.  Label the corresponding variance value as "deviant", remove the value from the variance data, and repeat the test on the remaining variance values at the lowered significance level.  Continue the process until you have identified and removed all deviant data sets at the lowered significance level.  Then run the test on the remaining variance data; let the significance level gradually increase until you reach your initial significance level.
4.4       Example case of two-sided G test

The considered data are identical to the data discussed in § 7 of the manuscript.
     Cell contents:
            D5:    "=B5-1"
            E5:    "=D5*C5^2"
            G5:    "=1/(1+(D13/D5-1)/FINV(1-G3/2/COUNT(C5:C12),D5,D13-D5))"
            H5:    "=E5/E13"
            I5:     "=1/(1+(D13/D5-1)/FINV(G3/2/COUNT(C5:C12),D5,D13-D5))"
     (...)      
            D13:  "=SUM(D5:D12)"
            D12:   "=B12-1"
            E12:   "=D12*C12^2"
            G12:   "=1/(1+(D13/D12-1)/FINV(1-G3/2/COUNT(C5:C12),D12,D13-D12))"
            H12:   "=E12/E13"
            I12:     "=1/(1+(D13/D12-1)/FINV(G3/2/COUNT(C5:C12),D12,D13-D12))"

            E13:  "=SUM(E5:E12)"



5. References

Use this link to visit the References.