Class KolmogorovSmirnovDistribution


  • final class KolmogorovSmirnovDistribution
    extends java.lang.Object
    Computes the complementary probability for the one-sample Kolmogorov-Smirnov distribution.
    Since:
    1.1
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) static class  KolmogorovSmirnovDistribution.One
      Computes the complementary probability P[D_n^+ >= x] for the one-sided one-sample Kolmogorov-Smirnov distribution.
      (package private) static class  KolmogorovSmirnovDistribution.Two
      Computes the complementary probability P[D_n >= x], or survival function (SF), for the two-sided one-sample Kolmogorov-Smirnov distribution.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static double EPS
      Machine epsilon, 2^-52.
      private static double PI2
      pi^2.
      private static double ROOT_TWO_PI
      sqrt(2*pi).
      private static double X_KS_HALF
      Value of x when the KS sum is 0.5.
      private static double X_KS_ONE
      Value of x when the KS sum is 1.0.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static double clipProbability​(double p)
      Clip the probability to the range [0, 1].
      (package private) static double ksSum​(double x)
      Computes P(sqrt(n) D_n > x), the limiting form for the distribution of Kolmogorov's D_n as described in Simard and L’Ecuyer (2011) (Eq.
      • Methods inherited from class java.lang.Object

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

      • KolmogorovSmirnovDistribution

        private KolmogorovSmirnovDistribution()
        No instances.
    • Method Detail

      • ksSum

        static double ksSum​(double x)
        Computes P(sqrt(n) D_n > x), the limiting form for the distribution of Kolmogorov's D_n as described in Simard and L’Ecuyer (2011) (Eq. 5, or K0 Eq. 6).

        Computes \( 2 \sum_{i=1}^\infty (-1)^(i-1) e^{-2 i^2 x^2} \), or \( 1 - (\sqrt{2 \pi} / x) * \sum_{i=1}^\infty { e^{-(2i-1)^2 \pi^2 / (8x^2) } } \) when x is small.

        Note: This computes the upper Kolmogorov sum.

        Parameters:
        x - Argument x = sqrt(n) * d
        Returns:
        Upper Kolmogorov sum evaluated at x
      • clipProbability

        static double clipProbability​(double p)
        Clip the probability to the range [0, 1].
        Parameters:
        p - Probability.
        Returns:
        p in [0, 1]