Anderson–Darling test
{{Short description|Statistical test}}
The Anderson–Darling test is a statistical test of whether a given sample of data is drawn 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 whether a normal distribution adequately describes a set of data, it is one of the most powerful statistical tools for detecting most departures from normality.
{{Cite journal | first = M. A. | last = Stephens |year = 1974 | title = EDF Statistics for Goodness of Fit and Some Comparisons
| journal = Journal of the American Statistical Association
| volume = 69 | issue = 347 | pages = 730–737
| doi = 10.2307/2286009| jstor = 2286009 }}
{{Cite book|editor1=D'Agostino, R. B. |editor2=Stephens, M. A. |
year = 1986| title = Goodness-of-Fit Techniques|
chapter = Tests Based on EDF Statistics| author = M. A. Stephens|
publisher = Marcel Dekker| location = New York| isbn = 0-8247-7487-6}}
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 procedure.
The test is named after Theodore Wilbur Anderson (1918–2016) and Donald A. Darling (1915–2014), who invented it in 1952.{{cite journal | first = T. W. | last = Anderson | author-link = Theodore W. Anderson
| author2 = Darling, D. A.
| author2-link = Donald Allan Darling
| year = 1952
| title = Asymptotic theory of certain "goodness-of-fit" criteria based on stochastic processes
| journal = Annals of Mathematical Statistics
| volume = 23 | issue = 2 | pages = 193–212
| doi = 10.1214/aoms/1177729437
| doi-access = free
}}
The single-sample test
The Anderson–Darling and Cramér–von Mises statistics belong to the class of
quadratic EDF statistics (tests based on the empirical 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
:
n \int_{-\infty}^\infty (F_n(x) - F(x))^2\,w(x)\,dF(x),
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
{{Cite journal|author1=Anderson, T.W. |author2=Darling, D.A.|title = A Test of Goodness-of-Fit| journal = Journal of the American Statistical Association| year = 1954| volume = 49|issue=268 |pages = 765–769| doi=10.2307/2281537|jstor=2281537 }} is based on the distance
:
A^2 = n \int_{-\infty}^\infty \frac{(F_n(x) - F(x))^2}{F(x)\; (1-F(x))} \, dF(x),
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 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 (CDF) of the data can be transformed to what should follow a uniform distribution. The data can be then tested for uniformity with a distance test (Shapiro 1980). The formula for the test statistic to assess if data
:
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{{cite journal|last=Razali |first=Nornadiah |author2=Wah, Yap Bee |title=Power comparisons of Shapiro–Wilk, Kolmogorov–Smirnov, Lilliefors and Anderson–Darling tests |journal=Journal of Statistical Modeling and Analytics |year=2011 |volume=2 |issue=1 |pages=21–33}} that the Anderson–Darling test is not quite as good as the Shapiro–Wilk test, but is better than other tests. Stephens found
The computation differs based on what is known about the distribution:{{Cite book|editor1=D'Agostino, R.B. |editor2=Stephens, M.A. |
year = 1986|
title = Goodness-of-Fit Techniques|
chapter = Tests for the Normal Distribution|
author = Ralph B. D'Agostino|
publisher = Marcel Dekker|
location = New York|
isbn = 0-8247-7487-6
}}
- Case 0: The mean
\mu and the variance\sigma^2 are both known. - Case 1: The variance
\sigma^2 is known, but the mean\mu is unknown. - Case 2: The mean
\mu is known, but the variance\sigma^2 is unknown. - Case 3: Both the mean
\mu and the variance\sigma^2 are unknown.
The n observations,
:
\hat{\mu} =
\begin{cases}
\mu, & \text{if the mean is known.} \\
\bar{X} = \frac{1}{n} \sum_{i = 1}^n X_i, & \text{otherwise.}
\end{cases}
:
\hat{\sigma}^2 =
\begin{cases}
\sigma^2, & \text{if the variance is known.} \\
\frac{1}{n} \sum_{i = 1}^n (X_i - \mu)^2, & \text{if the variance is not known, but the mean is.} \\
\frac{1}{n - 1} \sum_{i = 1}^n (X_i - \bar{X})^2, & \text{otherwise.}
\end{cases}
The values
:
With the standard normal CDF
:
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
:
A^{*2} =
\begin{cases}
A^2\left(1+\frac{4}{n}-\frac{25}{n^2}\right), & \text{if the variance and the mean are both unknown.} \\
A^2, & \text{otherwise.}
\end{cases}
If
some significance level. The critical values are given in the table below for values of
{{Cite journal | first = G.| last = Marsaglia|year = 2004 | title = Evaluating the Anderson-Darling Distribution
| journal = Journal of Statistical Software
| volume = 9 | issue = 2 | pages = 730–737 | doi = 10.18637/jss.v009.i02| doi-access = free| citeseerx = 10.1.1.686.1363}}
Note 1: If
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%.
class="wikitable" | ||||||
Case | n | 15% | 10% | 5% | 2.5% | 1% |
---|---|---|---|---|---|---|
0 | ≥ 5 | 1.621 | 1.933 | 2.492 | 3.070 | 3.878 |
1 | 0.908 | 1.105 | 1.304 | 1.573 | ||
2 | ≥ 5 | 1.760 | 2.323 | 2.904 | 3.690 | |
3 | 10 | 0.514 | 0.578 | 0.683 | 0.779 | 0.926 |
20 | 0.528 | 0.591 | 0.704 | 0.815 | 0.969 | |
50 | 0.546 | 0.616 | 0.735 | 0.861 | 1.021 | |
100 | 0.559 | 0.631 | 0.754 | 0.884 | 1.047 | |
0.576 | 0.656 | 0.787 | 0.918 | 1.092 |
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
=Tests for other distributions=
Above, it was assumed that the variable
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.{{cite journal |last1=Scholz |first1=F. W. |last2=Stephens |first2=M. A. |year=1987 |title=K-sample Anderson–Darling Tests |journal=Journal of the American Statistical Association |volume=82 |issue=399 |pages=918–924 |doi=10.1080/01621459.1987.10478517 }} The R package kSamples and the Python package Scipy implements this rank test for comparing k samples among several other such rank tests.{{cite web |title=kSamples: K-Sample Rank Tests and their Combinations |work=R Project |date=7 October 2023 |url=https://cran.r-project.org/web/packages/kSamples/index.html }}{{Cite web |title=The Anderson-Darling test for k-samples. Scipy package. |url=https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.anderson_ksamp.html}}
For
:
A^2_{kN} = \frac{1}{N} \sum_{i=1}^k \frac{1}{n_i} \sum_{j=1}^{N-1} \frac{(NM_{ij} - jn_i)^2}{j(N-j)}
where
See also
References
{{Reflist}}
Further reading
- Corder, G.W., Foreman, D.I. (2009).Nonparametric Statistics for Non-Statisticians: A Step-by-Step Approach Wiley, {{ISBN|978-0-470-45461-9}}
- Mehta, S. (2014) Statistics Topics {{ISBN|978-1499273533}}
- Pearson E.S., Hartley, H.O. (Editors) (1972) Biometrika Tables for Statisticians, Volume II. CUP. {{ISBN|0-521-06937-8}}.
- 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. {{ISBN|0-471-86725-X}}.
- Stephens, M.A. (1979) Test of fit for the logistic distribution based on the empirical distribution function, Biometrika, 66(3), 591–5.
External links
- [http://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm US NIST Handbook of Statistics]
{{DEFAULTSORT:Anderson-Darling test}}