Class StandardizedTwoSampleAndersonDarlingTest

  • All Implemented Interfaces:
    GoodnessOfFitTest

    @Reference(authors="F. W. Scholz, M. A. Stephens",title="K-sample Anderson\u2013Darling tests",booktitle="Journal of the American Statistical Association, 82(399)",url="https://doi.org/10.1080/01621459.1987.10478517",bibkey="doi:10.1080/01621459.1987.10478517") @Reference(authors="D. A. Darling",title="The Kolmogorov-Smirnov, Cramer-von Mises tests",booktitle="Annals of mathematical statistics 28(4)",url="https://doi.org/10.1214/aoms/1177706788",bibkey="doi:10.1214/aoms/1177706788") @Reference(authors="A. N. Pettitt",title="A two-sample Anderson-Darling rank statistic",booktitle="Biometrika 63 (1)",url="https://doi.org/10.1093/biomet/63.1.161",bibkey="doi:10.1093/biomet/63.1.161")
    public class StandardizedTwoSampleAndersonDarlingTest
    extends java.lang.Object
    implements GoodnessOfFitTest
    Perform a two-sample Anderson-Darling rank test, and standardize the statistic according to Scholz and Stephens. Ties are handled as discussed in Equation 7 of Scholz and Stephens.

    To access the non-standardized A2 scores, use the function unstandardized(double[][]).

    Compared to the Cramer-van Mises test, the Anderson-Darling test puts more weight on the tail of the distribution. This variant only uses the ranks.

    References:

    Darling's note on this equation

    D. A. Darling
    The Kolmogorov-Smirnov, Cramer-von Mises tests.
    Annals of Mathematical Statistics 28(4)

    More detailed discussion by Pettitt

    A. N. Pettitt
    A two-sample Anderson-Darling rank statistic
    Biometrika 63 (1)

    F. W. Scholz, M. A. Stephens
    K-sample Anderson–Darling tests
    Journal of the American Statistical Association, 82(399)

    Since:
    0.7.0
    Author:
    Erich Schubert
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double deviation​(double[][] samples)
      K-samples version of the Anderson-Darling test.
      double deviation​(double[] sample1, double[] sample2)
      Measure the deviation of a full sample from a conditional sample.
      private int totalLength​(double[][] samples)
      Total length of a set of Samples.
      double unstandardized​(double[][] samples)
      Compute the non-standardized A2 test statistic for the k-samples test.
      private double unstandardized​(double[][] samples, int N)
      Compute the non-standardized A2 test statistic for the k-samples test.
      double unstandardized​(double[] sample1, double[] sample2)
      Compute the non-standardized A2 test statistic for the k-samples test.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • StandardizedTwoSampleAndersonDarlingTest

        public StandardizedTwoSampleAndersonDarlingTest()
    • Method Detail

      • deviation

        public double deviation​(double[] sample1,
                                double[] sample2)
        Description copied from interface: GoodnessOfFitTest
        Measure the deviation of a full sample from a conditional sample.

        Sample arrays may be modified, e.g., sorted, by the test.

        Specified by:
        deviation in interface GoodnessOfFitTest
        Parameters:
        sample1 - Full sample
        sample2 - Conditional sample
        Returns:
        Deviation
      • deviation

        public double deviation​(double[][] samples)
        K-samples version of the Anderson-Darling test.
        Parameters:
        samples - Samples
        Returns:
        A2 score
      • unstandardized

        public double unstandardized​(double[][] samples)
        Compute the non-standardized A2 test statistic for the k-samples test.
        Parameters:
        samples - Samples
        Returns:
        Test statistic
      • unstandardized

        private double unstandardized​(double[][] samples,
                                      int N)
        Compute the non-standardized A2 test statistic for the k-samples test.

        This is based on Scholz and Stephens, Equation 7.

        Parameters:
        samples - Samples
        N - total length
        Returns:
        Test statistic
      • unstandardized

        public double unstandardized​(double[] sample1,
                                     double[] sample2)
        Compute the non-standardized A2 test statistic for the k-samples test.

        This is based on Scholz and Stephens, Equation 7.

        Parameters:
        sample1 - First sample
        sample2 - Second sample
        Returns:
        Test statistic
      • totalLength

        private int totalLength​(double[][] samples)
        Total length of a set of Samples.
        Parameters:
        samples - Samples
        Returns:
        Sum of the lengths.