- All Implemented Interfaces:
RealValuedDomainOps
All the methods for this class are static methods. The use of A, P and Q follows the convention in Abramowitz and Stegun, "Handbook of Mathematical Functions" (10th printing [1972], 9th Dover printing), chapter 26. Some of the methods have names that start with an upper-case letter, contrary to the usual Java convention, in order to conform to this text.
Suppose there is an ordered set of n uniform random variables, each having a value in the range [0, 1). The Kolmogorov distribution is the distribution of the quantity Dn = max(Dn-,Dn+) where
The algorithms used are described in George Marsaglia, Wai Wan Tsang, Jingbo Wang, "Evaluating Kolmogorov's Distribution" and Luis Carvalho, "An Improved Evaluation of Kolmogorov's Distribution"
Note that some authors use Dn while others use n1/2Dn as a statistic.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
Determine if the domain maximum is in the domain.boolean
Determine if the domain minimum is in the domain.double
Get the maximum value in the domain of the function.double
Get the minimum value in the domain of the function.boolean
isSymmetric
(double x) Determine if this distribution is symmetric about x.double
P
(double x) Get the probability that a value is no larger than the argumentstatic double
P
(double d, int n) Evaluate the cumulative probability function for the Kolmogorov distribution.static double
pdL
(double x, int n) Evaluate the probability density for the Kolmogorov distribution using an estimate of this distribution.static double
PL
(double x, int n) Evaluate the cumulative probability function for a Kolmogorov distribution using an estimate for this distribution.static double
Q
(double x, int n) Evaluate the complement of the cumulative probability function for the Kolmogorov distribution.static double
QL
(double x, int n) Evaluate the complement of the cumulative probability function for a Kolmogorov distribution using an estimate of this distribution.static void
setLimit
(double limit) Set the limit for using the limiting form.Methods inherited from class org.bzdev.math.stats.ProbDistribution
A, cdf, cdfc, inverseA, inverseP, inverseQ, isInDomain, pd, Q
-
Constructor Details
-
KDistr
public KDistr(int n) Constructor.- Parameters:
n
- the number of variates
-
-
Method Details
-
isSymmetric
public boolean isSymmetric(double x) Description copied from class:ProbDistribution
Determine if this distribution is symmetric about x. A distribution is symmetric if its probability density f satisfies f(x+y) = f(x-y) and that if x+y is in f's domain, so is x-y. Equivalently, it must satisfy Q(x+y) = P(x-y).- Specified by:
isSymmetric
in classProbDistribution
- Parameters:
x
- the point about which to test if this distribution is symmaetric- Returns:
- true if it is symmetric; false otherwise.
-
P
public double P(double x) Description copied from class:ProbDistribution
Get the probability that a value is no larger than the argument- Specified by:
P
in classProbDistribution
- Parameters:
x
- the argument- Returns:
- the probability
-
getDomainMin
public double getDomainMin()Description copied from interface:RealValuedDomainOps
Get the minimum value in the domain of the function.- Specified by:
getDomainMin
in interfaceRealValuedDomainOps
- Overrides:
getDomainMin
in classProbDistribution
- Returns:
- the minimum value
-
domainMinClosed
public boolean domainMinClosed()Description copied from interface:RealValuedDomainOps
Determine if the domain minimum is in the domain.- Specified by:
domainMinClosed
in interfaceRealValuedDomainOps
- Overrides:
domainMinClosed
in classProbDistribution
- Returns:
- true if the domain minimum is in the domain; false if it is the greatest lower bound for the domain
-
getDomainMax
public double getDomainMax()Description copied from interface:RealValuedDomainOps
Get the maximum value in the domain of the function.- Specified by:
getDomainMax
in interfaceRealValuedDomainOps
- Overrides:
getDomainMax
in classProbDistribution
- Returns:
- the maximum value
-
domainMaxClosed
public boolean domainMaxClosed()Description copied from interface:RealValuedDomainOps
Determine if the domain maximum is in the domain.- Specified by:
domainMaxClosed
in interfaceRealValuedDomainOps
- Overrides:
domainMaxClosed
in classProbDistribution
- Returns:
- true if the domain maximum is in the domain; false if it is the least upper bound for the domain
-
pdL
public static double pdL(double x, int n) Evaluate the probability density for the Kolmogorov distribution using an estimate of this distribution. The estimate uses the limiting form for this distribution, with accuracy improving as n → ∞.- Parameters:
x
- the argument representing a statisticn
- the number of variates- Returns:
- the probability density
-
PL
public static double PL(double x, int n) Evaluate the cumulative probability function for a Kolmogorov distribution using an estimate for this distribution. The estimate uses the limiting form for this distribution, with accuracy improving as n → ∞.- Parameters:
x
- the argument representing a statisticn
- the number of variates- Returns:
- the cumulative probability for the given arguments
-
QL
public static double QL(double x, int n) Evaluate the complement of the cumulative probability function for a Kolmogorov distribution using an estimate of this distribution. The estimate uses the limiting form for this distribution, with accuracy improving as n → ∞. Numerically QL(x,n) = 1 - PL(x,n)- Parameters:
x
- the argument representing a statisticn
- the number of variates- Returns:
- the complement of the cumulative probabilty for the given arguments
-
setLimit
public static void setLimit(double limit) Set the limit for using the limiting form. The limit is the minimum value of x*n beyond which the limiting form PL(x,n) will be used instead of the more accurate algorithm that P(x,n) implements. The default limit was determined by computing a relative difference, given by the absolute value of (Q(x,n)-QL(x,n))/Q(x,n), and finding the maximum value of x*n with the constraint that the relative difference is larger than 0.0001 and that Q(x,n) ≥ 1.e-10.- Parameters:
limit
- a positive number; 0 or negative for the default value
-
P
public static double P(double d, int n) Evaluate the cumulative probability function for the Kolmogorov distribution.- Parameters:
d
- the argument representing a statisticn
- the number of variates- Returns:
- the cumulative probability for the given arguments
-
Q
public static double Q(double x, int n) Evaluate the complement of the cumulative probability function for the Kolmogorov distribution. Numerically, Q(x,n) = 1 - P(x,n).- Parameters:
x
- the argument representing a statisticn
- the number of variates- Returns:
- the complement of the cumulative probability for the given arguments
-