umontreal.iro.lecuyer.probdist
Class KolmogorovSmirnovDist
- java.lang.Object
-
- umontreal.iro.lecuyer.probdist.ContinuousDistribution
-
- umontreal.iro.lecuyer.probdist.KolmogorovSmirnovDist
-
- All Implemented Interfaces:
- Distribution
- Direct Known Subclasses:
- KolmogorovSmirnovDistQuick
public class KolmogorovSmirnovDist extends ContinuousDistribution
Extends the classContinuousDistributionfor the Kolmogorov-Smirnov distribution with parameter n. Given an empirical distribution Fn with n independent observations and a continuous distribution F(x), the two-sided statistic is defined asDn = sup-∞ <= x <= ∞| Fn(x) - F(x)| = {Dn+, Dn-},where Dn+ and Dn- are the + and - statistics as defined in equations and on page
of this guide.
This class implements a high precision version of the
distribution
P[Dn <= x]; it is a Java translation of the C program
written in. According to its authors, it should give
13 decimal digits of precision. It is extremely slow
for large values of n.
-
-
Field Summary
-
Fields inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
decPrec
-
-
Constructor Summary
Constructors Constructor and Description KolmogorovSmirnovDist(int n)Constructs a distribution with parameter n.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublebarF(double x)Returns the complementary distribution function.static doublebarF(int n, double x)Computes the complementary distribution function bar(F)(x) with parameter n.doublecdf(double x)Returns the distribution function F(x).static doublecdf(int n, double x)Computes the distribution function F(x) with parameter n using Durbin's matrix formula.doubledensity(double x)Returns f (x), the density evaluated at x.static doubledensity(int n, double x)Computes the density for the distribution with parameter n.intgetN()Returns the parameter n of this object.double[]getParams()Returns an array containing the parameter n of this object.doubleinverseF(double u)Returns the inverse distribution function x = F-1(u).static doubleinverseF(int n, double u)Computes the inverse x = F-1(u) of the distribution F(x) with parameter n.voidsetN(int n)Sets the parameter n of this object.java.lang.StringtoString()-
Methods inherited from class umontreal.iro.lecuyer.probdist.ContinuousDistribution
getMean, getStandardDeviation, getVariance, getXinf, getXsup, inverseBisection, inverseBrent, setXinf, setXsup
-
-
-
-
Constructor Detail
-
KolmogorovSmirnovDist
public KolmogorovSmirnovDist(int n)
Constructs a distribution with parameter n. Restriction: n >= 1.
-
-
Method Detail
-
density
public double density(double x)
Description copied from class:ContinuousDistributionReturns f (x), the density evaluated at x.- Specified by:
densityin classContinuousDistribution- Parameters:
x- value at which the density is evaluated- Returns:
- density function evaluated at x
-
cdf
public double cdf(double x)
Description copied from interface:DistributionReturns the distribution function F(x).- Parameters:
x- value at which the distribution function is evaluated- Returns:
- distribution function evaluated at x
-
barF
public double barF(double x)
Description copied from class:ContinuousDistributionReturns the complementary distribution function. The default implementation computes bar(F)(x) = 1 - F(x).- Specified by:
barFin interfaceDistribution- Overrides:
barFin classContinuousDistribution- Parameters:
x- value at which the complementary distribution function is evaluated- Returns:
- complementary distribution function evaluated at x
-
inverseF
public double inverseF(double u)
Description copied from class:ContinuousDistributionReturns the inverse distribution function x = F-1(u). Restrictions: u∈[0, 1].- Specified by:
inverseFin interfaceDistribution- Overrides:
inverseFin classContinuousDistribution- Parameters:
u- value at which the inverse distribution function is evaluated- Returns:
- the inverse distribution function evaluated at u
-
density
public static double density(int n, double x)Computes the density for the distribution with parameter n.
-
cdf
public static double cdf(int n, double x)Computes the distribution function F(x) with parameter n using Durbin's matrix formula. It is a translation of the C program in; according to its authors, it returns 13 decimal digits of precision. It is extremely slow for large n.
-
barF
public static double barF(int n, double x)Computes the complementary distribution function bar(F)(x) with parameter n. Simply returns 1 - cdf(n,x). It is not precise in the upper tail.
-
inverseF
public static double inverseF(int n, double u)Computes the inverse x = F-1(u) of the distribution F(x) with parameter n.
-
getN
public int getN()
Returns the parameter n of this object.
-
setN
public void setN(int n)
Sets the parameter n of this object.
-
getParams
public double[] getParams()
Returns an array containing the parameter n of this object.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-
DMelt 3.0 © DataMelt by jWork.ORG