Class KolmogorovSmirnovDistribution

java.lang.Object
org.apache.commons.statistics.inference.KolmogorovSmirnovDistribution

final class KolmogorovSmirnovDistribution extends 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 final class 
    Computes the complementary probability P[D_n^+ >= x] for the one-sided one-sample Kolmogorov-Smirnov distribution.
    (package private) static final class 
    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 final double
    Machine epsilon, 2^-52.
    private static final double
    pi^2.
    private static final double
    sqrt(2*pi).
    private static final double
    Value of x when the KS sum is 0.5.
    private static final double
    Value of x when the KS sum is 1.0.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    No instances.
  • Method Summary

    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
  • Field Details

  • Constructor Details

    • KolmogorovSmirnovDistribution

      private KolmogorovSmirnovDistribution()
      No instances.
  • Method Details

    • 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]