Anderson–Darling test

In statistics, the Anderson–Darling test, named after Theodore Wilbur Anderson (1918–?) and Donald A. Darling (1915–?), who invented it in 1952, is a statistical test of whether there is evidence that a given sample of data did not arise from a given probability distribution. In its basic form, the test assumes that there are no parameters to be estimated in the distribution being tested, in which case the test and its set of critical values is distribution-free. However, the test is most often used in contexts where a family of distributions is being tested, in which case the parameters of that family need to be estimated and account must be taken of this in adjusting either the test-statistic or its critical values.

When applied to testing if a normal distribution adequately describes a set of data, it is one of the most powerful statistical tools for detecting most departures from normality.

In addition to its use as a test of fit for distributions, it can be used in parameter estimation as the basis for a form of minimum distance estimation procedure.

K-sample Anderson–Darling tests are available for testing whether several collections of observations can be modelled as coming from a single population, where the distribution function does not have to be specified.

Basic test statistic
The Anderson–Darling test assesses whether a sample comes from a specified distribution. It makes use of the fact that, when given a hypothesized underlying distribution and assuming the data does arise from this distribution, the data can be transformed to a uniform distribution. The transformed sample data can be then tested for uniformity with a distance test (Shapiro 1980). The formula for the test statistic $$A$$ to assess if data $$\{Y_1<\cdots <Y_n\}$$ (note that the data must be put in order) comes from a distribution with cumulative distribution function (CDF) $$F$$ is


 * $$A^2 = -n-S \,,$$

where


 * $$S=\sum_{k=1}^n \frac{2k-1}{n}\left[\ln F(Y_k) + \ln\left(1-F(Y_{n+1-k})\right)\right].$$

The test statistic can then be compared against the critical values of the theoretical distribution. Note that in this case no parameters are estimated in relation to the distribution function F.

Tests for families of distributions
Essentially the same test statistic can be used in the test of fit of a family of distributions, but then it must be compared against the critical values appropriate to that family of theoretical distributions and dependent also on the method used for parameter estimation.

Test for Normality
In comparisons of power, Stephens (1974) found $$A^2$$ to be one of the best Empirical distribution function statistics for detecting most departures from normality. The only statistic close was the $$W^2$$ Cramér–von Mises test statistic. It may be used with small sample sizes n ≤ 25. Very large sample sizes may reject the assumption of normality with only slight imperfections, but industrial data with sample sizes of 200 and more have passed the Anderson–Darling test.

(If testing for normal distribution of the variable X)

1) The data $$X_i$$, for $$i=1,\ldots n$$, of the variable $$X$$ that should be tested is sorted from low to high.

2) The mean $$\bar{X}$$ and standard deviation $$s$$ are calculated from the sample of $$X$$.

3) The values $$X_i$$ are standardized to create new values $$Y_i$$ as


 * $$Y_i=\frac{X_i-\bar{X}}{s}$$

4) With the standard normal CDF $$\Phi$$, $$A^2$$ is calculated using
 * $$A^2 = -n -\frac{1}{n} \sum_{i=1}^n (2i-1)(\ln \Phi(Y_i)+ \ln(1-\Phi(Y_{n+1-i}))).$$

An alternative expression in which only a single observation is dealt with at each step of the summation is:


 * $$A^2 = -n -\frac{1}{n} \sum_{i=1}^n\left[(2i-1)\ln\Phi(Y_i)+(2(n-i)+1)\ln(1-\Phi(Y_i))\right].$$

5) $$A^{*2}$$, an approximate adjustment for sample size, is calculated using


 * $$A^{*2}=A^2\left(1+\frac{4}{n}-\frac{25}{n^2}\right) .$$

6) If $$A^{*2}$$ exceeds 0.751 then the hypothesis of normality is rejected for a 5% level test.

Note 1: If s = 0 or any $$\Phi(Y_i)=$$(0 or 1) then $$A^2$$ cannot be calculated and is undefined.

Note 2: Other common critical values for $$A^{*2}$$ are .632 for a 10% level, .870 for a 2.5% level, and 1.029 for a 1% level. The above adjustment formulae and critical value are taken from Shorak & Wellner (1986, p239). Care is required in comparisons across different sources as often the specific adjustment formula is not stated.

Tests for other distributions
Above, it was assumed that the variable $$X_i$$ was being tested for normal distribution. Any other family of distributions can be tested but the test for each family is implemented by using a different modification of the basic test statistic and this is referred to critical values specific to that family of distributions. Tests for the (two-parameter) log-normal distribution can be implemented by transforming the data using a logarithm and using the above test for normality. Details for the required modifications to the test statistic and for the critical values for the normal distribution and the exponential distribution have been published by Pearson & Hartley (1972, Table 54). Details for these distributions, with the addition of the Gumbel distribution, are also given by Shorak & Wellner (1986, p239). Details for the logistic distribution are given by Stephens (1979). A test for the (two parameter) Weibull distribution can be obtained by making use of the fact that the logarithm of a Weibull variate has a Gumbel distribution.

Non-parametric k-sample tests
Scholz F.W. and Stephens M.A. (1987) discuss a test, based on the Anderson-Darling measure of agreement between distributions, for whether a number of random samples with possibly different sample sizes may have arisen from the same distribution, where this distribution is unspecified.