SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.probdist.KolmogorovSmirnovDist Class Reference

Extends the class ContinuousDistribution for the Kolmogorov-Smirnov distribution with parameter \(n\). More...

Inheritance diagram for umontreal.ssj.probdist.KolmogorovSmirnovDist:
umontreal.ssj.probdist.ContinuousDistribution umontreal.ssj.probdist.Distribution umontreal.ssj.probdist.KolmogorovSmirnovDistQuick

Public Member Functions

 KolmogorovSmirnovDist (int n)
 Constructs a Kolmogorov–Smirnov distribution with parameter.
double density (double x)
 Returns \(f(x)\), the density evaluated at \(x\).
double cdf (double x)
 Returns the distribution function \(F(x)\).
double barF (double x)
 Returns the complementary distribution function.
double inverseF (double u)
 Returns the inverse distribution function \(x = F^{-1}(u)\).
int getN ()
 Returns the parameter \(n\) of this object.
void setN (int n)
 Sets the parameter \(n\) of this object.
double[] getParams ()
 Returns an array containing the parameter \(n\) of this object.
String toString ()
 Returns a String containing information about the current distribution.
Public Member Functions inherited from umontreal.ssj.probdist.ContinuousDistribution
double inverseBrent (double a, double b, double u, double tol)
 Computes the inverse distribution function \(x = F^{-1}(u)\), using the Brent-Dekker method.
double inverseBisection (double u)
 Computes and returns the inverse distribution function \(x = F^{-1}(u)\), using bisection.
double getMean ()
 Returns the mean.
double getVariance ()
 Returns the variance.
double getStandardDeviation ()
 Returns the standard deviation.
double getXinf ()
 Returns \(x_a\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).
double getXsup ()
 Returns \(x_b\) such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).
void setXinf (double xa)
 Sets the value \(x_a=\) xa, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).
void setXsup (double xb)
 Sets the value \(x_b=\) xb, such that the probability density is 0 everywhere outside the interval \([x_a, x_b]\).

Static Public Member Functions

static double density (int n, double x)
 Computes the density for the Kolmogorov–Smirnov distribution with parameter \(n\).
static double cdf (int n, double x)
 Computes the Kolmogorov–Smirnov distribution function \(F(x)\) with parameter \(n\) using Durbin’s matrix formula [54] .
static double barF (int n, double x)
 Computes the complementary distribution function \(\bar{F}(x)\) with parameter \(n\).
static double inverseF (int n, double u)
 Computes the inverse \(x = F^{-1}(u)\) of the Kolmogorov–Smirnov distribution \(F(x)\) with parameter \(n\).

Detailed Description

Extends the class ContinuousDistribution for the Kolmogorov-Smirnov distribution with parameter \(n\).

[54] . Given an empirical distribution \(F_n\) with \(n\) independent observations and a continuous distribution \(F(x)\), the two-sided Kolmogorov–Smirnov statistic is defined as

\[ D_n = \sup_{-\infty\le x \le\infty} |F_n(x) - F(x)| = \max\{D_n^+, D_n^-\}, \]

where \(D_n^+\) and \(D_n^-\) are the Kolmogorov–Smirnov+ and Kolmogorov–Smirnov \(-\) statistics as defined in equations DNp and DNm of this guide. This class implements a high precision version of the Kolmogorov–Smirnov distribution \(P[D_n \le x]\); it is a Java translation of the \(C\) program written in [171] . According to its authors, it should give 13 decimal digits of precision. It is extremely slow for large values of \(n\).

Definition at line 52 of file KolmogorovSmirnovDist.java.

Constructor & Destructor Documentation

◆ KolmogorovSmirnovDist()

umontreal.ssj.probdist.KolmogorovSmirnovDist.KolmogorovSmirnovDist ( int n)

Constructs a Kolmogorov–Smirnov distribution with parameter.

\(n\). Restriction: \(n \ge1\).

Definition at line 82 of file KolmogorovSmirnovDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.barF ( double x)

Returns the complementary distribution function.

The default implementation computes \(\bar{F}(x) = 1 - F(x)\).

Parameters
xvalue at which the complementary distribution function is evaluated
Returns
complementary distribution function evaluated at x

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 94 of file KolmogorovSmirnovDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.barF ( int n,
double x )
static

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.

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 351 of file KolmogorovSmirnovDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.cdf ( double x)

Returns the distribution function \(F(x)\).

Parameters
xvalue at which the distribution function is evaluated
Returns
distribution function evaluated at x

Implements umontreal.ssj.probdist.Distribution.

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 90 of file KolmogorovSmirnovDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.cdf ( int n,
double x )
static

Computes the Kolmogorov–Smirnov distribution function \(F(x)\) with parameter \(n\) using Durbin’s matrix formula [54] .

It is a translation of the \(C\) program in [171] ; according to its authors, it returns 13 decimal digits of precision. It is extremely slow for large \(n\).

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 310 of file KolmogorovSmirnovDist.java.

◆ density() [1/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.density ( double x)

Returns \(f(x)\), the density evaluated at \(x\).

Parameters
xvalue at which the density is evaluated
Returns
density function evaluated at x

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 86 of file KolmogorovSmirnovDist.java.

◆ density() [2/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.density ( int n,
double x )
static

Computes the density for the Kolmogorov–Smirnov distribution with parameter \(n\).

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 134 of file KolmogorovSmirnovDist.java.

◆ getN()

int umontreal.ssj.probdist.KolmogorovSmirnovDist.getN ( )

Returns the parameter \(n\) of this object.

Definition at line 404 of file KolmogorovSmirnovDist.java.

◆ getParams()

double[] umontreal.ssj.probdist.KolmogorovSmirnovDist.getParams ( )

Returns an array containing the parameter \(n\) of this object.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 422 of file KolmogorovSmirnovDist.java.

◆ inverseF() [1/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.inverseF ( double u)

Returns the inverse distribution function \(x = F^{-1}(u)\).

Restrictions: \(u \in[0,1]\).

Parameters
uvalue at which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u
Exceptions
IllegalArgumentExceptionif \(u\) is not in the interval \([0,1]\)

Reimplemented from umontreal.ssj.probdist.ContinuousDistribution.

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 98 of file KolmogorovSmirnovDist.java.

◆ inverseF() [2/2]

double umontreal.ssj.probdist.KolmogorovSmirnovDist.inverseF ( int n,
double u )
static

Computes the inverse \(x = F^{-1}(u)\) of the Kolmogorov–Smirnov distribution \(F(x)\) with parameter \(n\).

Reimplemented in umontreal.ssj.probdist.KolmogorovSmirnovDistQuick.

Definition at line 393 of file KolmogorovSmirnovDist.java.

◆ setN()

void umontreal.ssj.probdist.KolmogorovSmirnovDist.setN ( int n)

Sets the parameter \(n\) of this object.

Definition at line 411 of file KolmogorovSmirnovDist.java.

◆ toString()

String umontreal.ssj.probdist.KolmogorovSmirnovDist.toString ( )

Returns a String containing information about the current distribution.

Definition at line 430 of file KolmogorovSmirnovDist.java.


The documentation for this class was generated from the following file: