kSamples (version 1.2-7)

ad.pval: \(P\)-Value for the Asymptotic Anderson-Darling Test Distribution

Description

This function computes upper tail probabilities for the limiting distribution of the standardized Anderson-Darling test statistic.

Usage

ad.pval(tx,m,version=1)

Arguments

tx

a vector of desired thresholds \(\ge 0\)

m

The degrees of freedom for the asymptotic standardized Anderson-Darling test statistic

version

= 1 (default) if \(P\)-value for version 1 of the test statistic is desired, otherwise the version 2 \(P\)-value is calculated.

Value

a vector of upper tail probabilities corresponding to tx

Details

Extensive simulations (sampling from a common continuous distribution) were used to extend the range of the asymptotic \(P\)-value calculation from the original \([.01,.25]\) in Table 1 of the reference paper to 36 quantiles corresponding to \(P\) = .00001, .00005, .0001, .0005, .001, .005, .01, .025, .05, .075, .1, .2, .3, .4, .5, .6, .7, .8, .9, .925, .95, .975, .99, .9925, .995, .9975, .999, .99925, .9995, .99975, .9999, .999925, .99995, .999975, .99999. Note that the entries of the original Table 1 were obtained by using the first 4 moments of the asymptotic distribution and a Pearson curve approximation.

Using ad.test, 1 million replications of the standardized \(AD\) statistics with sample sizes \(n_i=500\), \(i=1,\ldots,k\) were run for \(k=2,3,4,5,7\) (\(k=2\) was done twice). These values of \(k\) correspond to degrees of freedom \(m=k-1=1,2,3,4,6\) in the asymptotic distribution. The random variable described by this distribution is denoted by \(T_m\). The actual variances (for \(n_i=500\)) agreed fairly well with the asymptotic variances.

Using the convolution nature of the asymptotic distribution, the performed simulations were exploited to result in an effective simulation of 2 million cases, except for \(k=11\), i.e., \(m=k-1=10\), for which the asymptotic distribution of \(T_{10}\) was approximated by the sum of the \(AD\) statistics for \(k=7\) and \(k=5\), for just the 1 million cases run for each \(k\).

The interpolation of tail probabilities \(P\) for any desired \(k\) is done in two stages. First, a spline in \(1/\sqrt{m}\) is fitted to each of the 36 quantiles obtained for \(m=1,2,3,4,6,8,10,\infty\) to obtain the corresponding interpolated quantiles for the \(m\) in question.

Then a spline is fitted to the \(\log((1-P)/P)\) as a function of these 36 interpolated quantiles. This latter spline is used to determine the tail probabilities \(P\) for the specified threshold tx, corresponding to either \(AD\) statistic version. The above procedure is based on simulations for either version of the test statistic, appealing to the same limiting distribution.

References

Scholz, F. W. and Stephens, M. A. (1987), K-sample Anderson-Darling Tests, Journal of the American Statistical Association, Vol 82, No. 399, 918--924.

See Also

ad.test, ad.test.combined

Examples

Run this code
# NOT RUN {
ad.pval(tx=c(3.124,5.65),m=2,version=1)
ad.pval(tx=c(3.124,5.65),m=2,version=2)
# }

Run the code above in your browser using DataLab