Anderson-Darling Test

The Anderson-Darling Test (Anderson and Darling, 1952 and 1954) measures the distance between the empirical distribution of the standardized returns and the normal distribution, with weights that grow towards the tails. It improves on the Kolmogorov-Smirnov test, which only looks at the largest gap between the two distributions and is least sensitive in the tails, where returns depart from normality most.

The formula for the Anderson-Darling Test first standardizes the sorted returns \(y_{1}\) to \(y_{n}\) with the mean of the returns r and their sample standard deviation s (with n - 1 in the denominator):

\[z_{i} = \frac{y_{i} - \operatorname{mean}\left(r\right)}{s}\]

The statistic then sums the logarithms of the normal distribution function Phi at the standardized returns, pairing the i-th smallest with the i-th largest so that both tails count:

\[A^{2} = -n - \frac{\sum_{i=1}^{n} (2 \cdot i - 1) \cdot \left(\ln\left(\Phi(z_{i})\right) + \ln\left(1 - \Phi(z_{n+1-i})\right)\right)}{n}\]

As the mean and the standard deviation are estimated from the same returns, D’Agostino and Stephens (1986) adjust the statistic for the sample size n:

\[A_{\text{adj}} = A^{2} \cdot \left(1 + \frac{0.75}{n} + \frac{2.25}{n^{2}}\right)\]

They give the p-value of the adjusted statistic in four pieces by its size; the piece for an adjusted statistic of at least 0.6 is:

\[\text{P Value} = \exp\left(1.2937 - 5.709 \cdot A_{\text{adj}} + 0.0186 \cdot A_{\text{adj}}^{2}\right) \quad \text{if } A_{\text{adj}} \geq 0.6\]

A large statistic, with a p-value below the significance level, rejects normality. Its weight on the tails makes it the test that reacts most to fat tails, so a few extreme returns can decide it.

A normality test asks whether a sample could come from a normal distribution: the null hypothesis is that it does, the alternative that it comes from any other distribution. The question matters because the Gaussian Value at Risk, the Black-Scholes model and many statistical tests assume normally distributed returns, while returns tend to be skewed and fat-tailed. The tests differ in the departure from normality they are most sensitive to. Every one of them reads the same way: a p-value below the chosen significance level (such as 0.05) rejects normality, while a higher p-value only means the sample gives no evidence against it, not that the returns are normal. In a long sample a test rejects even a departure too small to matter, and in a short one it misses a large one.

Also known as: AD test, Anderson-Darling A-squared test.

In the Finance Toolkit this is get_normality_test with method="anderson_darling", the same function as Normality Test.

Example · ^GSPC, BTCUSD, TLT · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_normality_test:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["^GSPC", "BTCUSD", "TLT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.econometrics.get_normality_test(method="anderson_darling", period="monthly")

Which returns:

Using Your Own Data

get_normality_test runs on any data, not only prices: ratios, economic indicators, yield curves or your own dataset. Pass a DataFrame, a Series or a dictionary of them to Econometrics as data, with the dates in the rows or the columns, and set changes to how its changes are calculated: "percentage", "log", "difference" for rates and ratios, or None when the data are changes already. For example, for the monthly unemployment rates of the United States and Germany:

from financetoolkit import Economics, Econometrics

economics = Economics(start_date="2000-01-01")

unemployment = economics.get_unemployment_rate(
    countries=["United States", "Germany"], period="monthly"
)

econometrics = Econometrics(data=unemployment, changes="difference")

econometrics.get_normality_test()

References

  • Paper Anderson, T.W. and Darling, D.A. (1952). “Asymptotic Theory of Certain ‘Goodness of Fit’ Criteria Based on Stochastic Processes.” Annals of Mathematical Statistics, 23(2), 193-212.
  • Paper Anderson, T.W. and Darling, D.A. (1954). “A Test of Goodness of Fit.” Journal of the American Statistical Association, 49(268), 765-769.
  • Paper D’Agostino, R.B. and Stephens, M.A. (1986). “Goodness-of-Fit Techniques.” Marcel Dekker, New York.
  • Library Referenced against statsmodels’ normal_ad (Anderson-Darling Test)
  • Library Referenced against scipy’s anderson (Anderson-Darling Test)
Share