/** * Calculates the [Anderson-Darling statistic]{@link https://en.wikipedia.org/wiki/Anderson%E2%80%93Darling_test} * for an array of values against a cumulative distribution function, testing the null hypothesis * that the sample is drawn from the distribution the CDF represents. The asymptotic p-value uses * the Marsaglia & Marsaglia (2004) rational-function approximation to the limiting distribution's * CDF, with their finite-sample correction. * * @method andersonDarling * @memberof ran.test * @param {number[]} values Array of values to perform the test for. * @param {Function} cdf Cumulative distribution function to test against. * @param {number} [alpha = 0.05] Confidence level. * @returns {{stat: number, pValue: number, passed: boolean}} Object containing the test statistic * (A²), the asymptotic goodness-of-fit p-value, and whether the sample passed the null hypothesis * that it is drawn from the tested distribution. * @throws {Error} If values is empty. * @example * * let normal = new ran.dist.Normal(0, 1) * * ran.test.andersonDarling(normal.sample(100), x => normal.cdf(x)) * // => { stat: 0.231, pValue: 0.789, passed: true } */ export default function (values: number[], cdf: Function, alpha?: number): { stat: number; pValue: number; passed: boolean; };