pub fn ad2_test<T>(
sample1: Vec<T>,
sample2: Vec<T>,
) -> Result<TestResult, TestError>where
T: PartialOrd + Copy,Expand description
Perform Anderson-Darling two sample test
Should only be used with continuous distributions and large samples! (More than few 100s).
Implementation is based on the (Pettitt 1976) paper. As the result can be used only for continuous distributions where the duplicate values in the samples have vanishingly small probability to occur.
Note that the (Pettitt 1976) seems to have slightly different behaviour from the $ A^2_{kN} $ statistic of (Scholz 1987) if the duplicate samples are present.
The p-value of the test is obtained using the simplified expression of (Marsaglia 2004) [see the C code distributed with the paper]. The p-value calculation uses large-sample approximation and may overestimate the distribution for smaller sample sizes.
§References
- Pettitt, A. N. (1976). A Two-Sample Anderson–Darling Rank Statistic. Biometrika, 63(1), 161–168. https://doi.org/10.2307/2335097
- Scholz, F. W., & Stephens, M. A. (1987). K-Sample Anderson-Darling Tests. Journal of the American Statistical Association, 82(399), 918–924. https://doi.org/10.2307/2288805
- Marsaglia, G., & Marsaglia, J. (2004). Evaluating the Anderson-Darling Distribution. Journal of Statistical Software, 9(2), 1–5. https://doi.org/10.18637/jss.v009.i02