The Anderson–Darling test is a
statistical test
A statistical hypothesis test is a method of statistical inference used to decide whether the data at hand sufficiently support a particular hypothesis.
Hypothesis testing allows us to make probabilistic statements about population parameters.
...
of whether a given sample of data is drawn from a given
probability distribution
In probability theory and statistics, a probability distribution is the mathematical function that gives the probabilities of occurrence of different possible outcomes for an experiment. It is a mathematical description of a random phenomenon i ...
. 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 whether a
normal distribution
In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is
:
f(x) = \frac e^
The parameter \mu ...
adequately describes a set of data, it is one of the most powerful statistical tools for detecting most departures from
normality.
[
][
]
''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.
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
Minimum-distance estimation (MDE) is a conceptual method for fitting a statistical model to data, usually the empirical distribution. Often-used estimators such as ordinary least squares can be thought of as special cases of minimum-distance esti ...
procedure.
The test is named after
Theodore Wilbur Anderson
Theodore Wilbur Anderson (June 5, 1918 – September 17, 2016) was an American mathematician and statistician who specialized in the analysis of multivariate data.
He was born in Minneapolis, Minnesota. He was on the faculty of Columbia Univ ...
(1918–2016) and
Donald A. Darling (1915–2014), who invented it in 1952.
The single-sample test
The Anderson–Darling and
Cramér–von Mises statistics belong to the class of
quadratic
EDF EDF may refer to:
Organisations
* Eclaireurs de France, a French Scouting association
* Education for Development Foundation, a Thai charity
* Électricité de France, a French energy company
** EDF Energy, their British subsidiary
** EDF Luminus, ...
statistics (tests based on the
empirical distribution function
In statistics, an empirical distribution function (commonly also called an empirical Cumulative Distribution Function, eCDF) is the distribution function associated with the empirical measure of a sample. This cumulative distribution function ...
).
[ If the hypothesized distribution is , and empirical (sample) cumulative distribution function is , then the quadratic EDF statistics measure the distance between and by
:
where is the number of elements in the sample, and is a weighting function. When the weighting function is , the statistic
is the Cramér–von Mises statistic. The Anderson–Darling (1954) test][
] is based on the distance
:
which is obtained when the weight function is . Thus, compared with the Cramér–von Mises distance, the Anderson–Darling distance places more weight on observations in the tails of the distribution.
Basic test statistic
The Anderson–Darling test assesses whether a sample
Sample or samples may refer to:
Base meaning
* Sample (statistics), a subset of a population – complete data set
* Sample (signal), a digital discrete sample of a continuous analog signal
* Sample (material), a specimen or small quantity of s ...
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 cumulative distribution function
In probability theory and statistics, the cumulative distribution function (CDF) of a real-valued random variable X, or just distribution function of X, evaluated at x, is the probability that X will take a value less than or equal to x.
Ev ...
(CDF) of the data can be assumed to follow a uniform distribution. The data can be then tested for uniformity with a distance test (Shapiro 1980). The formula for the test statistic
A test statistic is a statistic (a quantity derived from the sample) used in statistical hypothesis testing.Berger, R. L.; Casella, G. (2001). ''Statistical Inference'', Duxbury Press, Second Edition (p.374) A hypothesis test is typically specif ...
to assess if data (note that the data must be put in order) comes from a CDF is
:
where
:
The test statistic can then be compared against the critical values of the theoretical distribution. In this case, no parameters are estimated in relation to the cumulative distribution function .
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
Empirical testing has found that the Anderson–Darling test is not quite as good as the Shapiro–Wilk test, but is better than other tests. Stephens[ found to be one of the best ]empirical distribution function
In statistics, an empirical distribution function (commonly also called an empirical Cumulative Distribution Function, eCDF) is the distribution function associated with the empirical measure of a sample. This cumulative distribution function ...
statistics for detecting most departures from normality.
The computation differs based on what is known about the distribution:
* Case 0: The mean and the variance are both known.
* Case 1: The variance is known, but the mean is unknown.
* Case 2: The mean is known, but the variance is unknown.
* Case 3: Both the mean and the variance are unknown.
The ''n'' observations, , for , of the variable must be sorted such that and the notation in the following assumes that ''Xi'' represent the ordered observations. Let
:
:
The values are standardized to create new values , given by
:
With the standard normal CDF , is calculated using
:
An alternative expression in which only a single observation is dealt with at each step of the summation is:
:
A modified statistic can be calculated using
:
If or exceeds a given critical value, then the hypothesis of normality is rejected with
some significance level. The critical values are given in the table below for values of .[
][
]
Note 1: If = 0 or any (0 or 1) then cannot be calculated and is undefined.
Note 2: The above adjustment formula is taken from Shorack & Wellner (1986, p239). Care is required in comparisons across different sources as often the specific adjustment formula is not stated.
Note 3: Stephens[ notes that the test becomes better when the parameters are computed from the data, even if they are known.
Note 4: Marsaglia & Marsaglia][ provide a more accurate result for Case 0 at 85% and 99%.
Alternatively, for case 3 above (both mean and variance unknown), D'Agostino (1986) ][ in Table 4.7 on p. 123 and on pages 372–373 gives the adjusted statistic:
:
and normality is rejected if exceeds 0.631, 0.754, 0.884, 1.047, or 1.159 at 10%, 5%, 2.5%, 1%, and 0.5% significance levels, respectively; the procedure is valid for sample size at least n=8. The formulas for computing the ''p''-values for other values of are given in Table 4.9 on p. 127 in the same book.
]
Tests for other distributions
Above, it was assumed that the variable 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. The modifications of the statistic and tables of critical values are given by Stephens (1986)[ for the exponential, extreme-value, Weibull, gamma, logistic, Cauchy, and von Mises distributions. Tests for the (two-parameter) ]log-normal distribution
In probability theory, a log-normal (or lognormal) distribution is a continuous probability distribution of a random variable whose logarithm is normally distributed. Thus, if the random variable is log-normally distributed, then has a normal ...
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
In statistics, a normal distribution or Gaussian distribution is a type of continuous probability distribution for a real-valued random variable. The general form of its probability density function is
:
f(x) = \frac e^
The parameter \mu ...
and the exponential distribution
In probability theory and statistics, the exponential distribution is the probability distribution of the time between events in a Poisson point process, i.e., a process in which events occur continuously and independently at a constant average ...
have been published by Pearson & Hartley (1972, Table 54). Details for these distributions, with the addition of the Gumbel distribution
In probability theory and statistics, the Gumbel distribution (also known as the type-I generalized extreme value distribution) is used to model the distribution of the maximum (or the minimum) of a number of samples of various distributions.
Thi ...
, are also given by Shorack & Wellner (1986, p239). Details for the logistic distribution
Logistic may refer to:
Mathematics
* Logistic function, a sigmoid function used in many fields
** Logistic map, a recurrence relation that sometimes exhibits chaos
** Logistic regression, a statistical model using the logistic function
** Logit, ...
are given by Stephens (1979). A test for the (two parameter) Weibull distribution
In probability theory and statistics, the Weibull distribution is a continuous probability distribution. It is named after Swedish mathematician Waloddi Weibull, who described it in detail in 1951, although it was first identified by Maurice Ren ...
can be obtained by making use of the fact that the logarithm of a Weibull variate has a Gumbel distribution
In probability theory and statistics, the Gumbel distribution (also known as the type-I generalized extreme value distribution) is used to model the distribution of the maximum (or the minimum) of a number of samples of various distributions.
Thi ...
.
Non-parametric ''k''-sample tests
Fritz Scholz and Michael A. Stephens (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. The R package kSamples and the Python
Python may refer to:
Snakes
* Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia
** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia
* Python (mythology), a mythical serpent
Computing
* Python (pro ...
package Scipy
SciPy (pronounced "sigh pie") is a free and open-source Python library used for scientific computing and technical computing.
SciPy contains modules for optimization, linear algebra, integration, interpolation, special functions, FFT, signal ...
implements this rank test for comparing k samples among several other such rank tests.
For samples the statistic can be computed as follows under the assumption that the distribution function of -th sample is continuous
:
where
* is the number of observations in the -th sample
* is the total number of observations in all samples
* is the pooled ordered sample
* is the number of observations in the -th sample that are not greater than .[
]
See also
*Kolmogorov–Smirnov test
In statistics, the Kolmogorov–Smirnov test (K–S test or KS test) is a nonparametric test of the equality of continuous (or discontinuous, see Section 2.2), one-dimensional probability distributions that can be used to compare a sample with a ...
*Kuiper's test Kuiper's test is used in statistics to test that whether a given distribution, or family of distributions, is contradicted by evidence from a sample of data. It is named after Dutch mathematician Nicolaas Kuiper.
Kuiper's test is closely related ...
* Shapiro–Wilk test
*Jarque–Bera test
In statistics, the Jarque–Bera test is a goodness-of-fit test of whether sample data have the skewness and kurtosis matching a normal distribution. The test is named after Carlos Jarque and Anil K. Bera.
The test statistic is always nonnegativ ...
*Goodness of fit
The goodness of fit of a statistical model describes how well it fits a set of observations. Measures of goodness of fit typically summarize the discrepancy between observed values and the values expected under the model in question. Such measure ...
References
Further reading
* Corder, G.W., Foreman, D.I. (2009).''Nonparametric Statistics for Non-Statisticians: A Step-by-Step Approach'' Wiley,
* Mehta, S. (2014) ''Statistics Topics''
* Pearson E.S., Hartley, H.O. (Editors) (1972) ''Biometrika Tables for Statisticians'', Volume II. CUP. .
* Shapiro, S.S. (1980) How to test normality and other distributional assumptions. In: The ASQC basic references in quality control: statistical techniques 3, pp. 1–78.
* Shorack, G.R., Wellner, J.A. (1986) ''Empirical Processes with Applications to Statistics'', Wiley. .
* Stephens, M.A. (1979) ''Test of fit for the logistic distribution based on the empirical distribution function'', Biometrika, 66(3), 591–5.
External links
US NIST Handbook of Statistics
{{DEFAULTSORT:Anderson-Darling test
Statistical tests
Nonparametric statistics
Normality tests