C# Class Accord.Statistics.Distributions.Univariate.KolmogorovSmirnovDistribution

Inheritance: UnivariateContinuousDistribution, IFormattable
Show file Open project: accord-net/framework Class Usage Examples

Public Methods

Method Description
Clone ( ) : object

Creates a new object that is a copy of the current instance.

ComplementaryDistributionFunction ( double x ) : double

Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.

The Complementary Cumulative Distribution Function (CCDF) is the complement of the Cumulative Distribution Function, or 1 minus the CDF.

ComplementaryDistributionFunction ( double n, double x ) : double

Computes the Complementary Cumulative Distribution Function (1-CDF) for the Kolmogorov-Smirnov statistic's distribution.

CumulativeFunction ( double n, double x ) : double

Computes the Cumulative Distribution Function (CDF) for the Kolmogorov-Smirnov statistic's distribution.

This function computes the cumulative probability P[Dn <= x] of the Kolmogorov-Smirnov distribution using multiple methods as suggested by Richard Simard (2010).

Simard partitioned the problem of evaluating the CDF using multiple approximation and asymptotic methods in order to achieve a best compromise between speed and precision. This function follows the same partitioning as Simard, which is described in the table below.

For n <= 140 and: 1/n > x >= 1-1/nUses the Ruben-Gambino formula. 1/n < nx² < 0.754693Uses the Durbin matrix algorithm. 0.754693 <= nx² < 4Uses the Pomeranz algorithm. 4 <= nx² < 18Uses the complementary distribution function. nx² >= 18Returns the constant 1. For 140 < n <= 10^5 nx² >= 18Returns the constant 1. nx^(3/2) < 1.4Durbin matrix algorithm. nx^(3/2) > 1.4Pelz-Good asymptotic series. For n > 10^5 nx² >= 18Returns the constant 1. nx² < 18Pelz-Good asymptotic series.
DistributionFunction ( double x ) : double

Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.

The Cumulative Distribution Function (CDF) describes the cumulative probability that a given value or any value smaller than it will occur.

Durbin ( int n, double d ) : double

Durbin's algorithm for computing P[Dn < d]

The method presented by Marsaglia (2003), as stated in the paper, is based on a succession of developments starting with Kolmogorov and culminating in a masterful treatment by Durbin (1972). Durbin's monograph summarized and extended many previous works published in the years 1933-73.

This function implements the small C procedure provided by Marsaglia on his paper with corrections made by Simard (2010). Further optimizations also have been performed.

References: - Marsaglia, G., Tsang, W. W., Wang, J. (2003) "Evaluating Kolmogorov's Distribution", Journal of Statistical Software, 8 (18), 1–4. jstor. Available on: http://www.jstatsoft.org/v08/i18/paper - Durbin, J. (1972) Distribution Theory for Tests Based on The Sample Distribution Function, Society for Industrial & Applied Mathematics, Philadelphia.
Fit ( double observations, double weights, Fitting options ) : void

Not supported.

KolmogorovSmirnovDistribution ( [ samples ) : System

Creates a new Kolmogorov-Smirnov distribution.

LogProbabilityDensityFunction ( double x ) : double

Not supported.

OneSideDistributionFunction ( double x ) : double

Computes the Upper Tail of the P[Dn >= x] distribution.

This function approximates the upper tail of the P[Dn >= x] distribution using the one-sided Kolmogorov-Smirnov statistic.

OneSideUpperTail ( double n, double x ) : double

Computes the Upper Tail of the P[Dn >= x] distribution.

This function approximates the upper tail of the P[Dn >= x] distribution using the one-sided Kolmogorov-Smirnov statistic.

PelzGood ( double n, double x ) : double

Pelz-Good algorithm for computing lower-tail areas of the Kolmogorov-Smirnov distribution.

As stated in Simard's paper, Pelz and Good (1976) generalized Kolmogorov's approximation to an asymptotic series in 1/sqrt(n).

References: Wolfgang Pelz and I. J. Good, "Approximating the Lower Tail-Areas of the Kolmogorov-Smirnov One-Sample Statistic", Journal of the Royal Statistical Society, Series B. Vol. 38, No. 2 (1976), pp. 152-156

Pomeranz ( int n, double x ) : double

Pomeranz algorithm.

ProbabilityDensityFunction ( double x ) : double

Not supported.

ToString ( string format, IFormatProvider formatProvider ) : string

Returns a System.String that represents this instance.

Private Methods

Method Description
computeA ( int n, double A, double z ) : void

Creates matrix A of the Pomeranz algorithm.

computeH ( int n, double A, double H ) : double

Computes matrix H of the Pomeranz algorithm.

computeLimits ( double t, double floors, double ceilings ) : double

Initializes the Pomeranz algorithm.

matrixPower ( double A, int eA, double V, int &eV, int m, int n, double B ) : void

Computes matrix power. Used in the Durbin algorithm.

Method Details

Clone() public method

Creates a new object that is a copy of the current instance.
public Clone ( ) : object
return object

ComplementaryDistributionFunction() public method

Gets the complementary cumulative distribution function (ccdf) for this distribution evaluated at point x. This function is also known as the Survival function.
The Complementary Cumulative Distribution Function (CCDF) is the complement of the Cumulative Distribution Function, or 1 minus the CDF.
public ComplementaryDistributionFunction ( double x ) : double
x double
return double

ComplementaryDistributionFunction() public static method

Computes the Complementary Cumulative Distribution Function (1-CDF) for the Kolmogorov-Smirnov statistic's distribution.
public static ComplementaryDistributionFunction ( double n, double x ) : double
n double The sample size.
x double The Kolmogorov-Smirnov statistic.
return double

CumulativeFunction() public static method

Computes the Cumulative Distribution Function (CDF) for the Kolmogorov-Smirnov statistic's distribution.

This function computes the cumulative probability P[Dn <= x] of the Kolmogorov-Smirnov distribution using multiple methods as suggested by Richard Simard (2010).

Simard partitioned the problem of evaluating the CDF using multiple approximation and asymptotic methods in order to achieve a best compromise between speed and precision. This function follows the same partitioning as Simard, which is described in the table below.

For n <= 140 and: 1/n > x >= 1-1/nUses the Ruben-Gambino formula. 1/n < nx² < 0.754693Uses the Durbin matrix algorithm. 0.754693 <= nx² < 4Uses the Pomeranz algorithm. 4 <= nx² < 18Uses the complementary distribution function. nx² >= 18Returns the constant 1. For 140 < n <= 10^5 nx² >= 18Returns the constant 1. nx^(3/2) < 1.4Durbin matrix algorithm. nx^(3/2) > 1.4Pelz-Good asymptotic series. For n > 10^5 nx² >= 18Returns the constant 1. nx² < 18Pelz-Good asymptotic series.
public static CumulativeFunction ( double n, double x ) : double
n double The sample size.
x double The Kolmogorov-Smirnov statistic.
return double

DistributionFunction() public method

Gets the cumulative distribution function (cdf) for this distribution evaluated at point x.
The Cumulative Distribution Function (CDF) describes the cumulative probability that a given value or any value smaller than it will occur.
public DistributionFunction ( double x ) : double
x double A single point in the distribution range.
return double

Durbin() public static method

Durbin's algorithm for computing P[Dn < d]

The method presented by Marsaglia (2003), as stated in the paper, is based on a succession of developments starting with Kolmogorov and culminating in a masterful treatment by Durbin (1972). Durbin's monograph summarized and extended many previous works published in the years 1933-73.

This function implements the small C procedure provided by Marsaglia on his paper with corrections made by Simard (2010). Further optimizations also have been performed.

References: - Marsaglia, G., Tsang, W. W., Wang, J. (2003) "Evaluating Kolmogorov's Distribution", Journal of Statistical Software, 8 (18), 1–4. jstor. Available on: http://www.jstatsoft.org/v08/i18/paper - Durbin, J. (1972) Distribution Theory for Tests Based on The Sample Distribution Function, Society for Industrial & Applied Mathematics, Philadelphia.
public static Durbin ( int n, double d ) : double
n int
d double
return double

Fit() public method

Not supported.
public Fit ( double observations, double weights, Fitting options ) : void
observations double
weights double
options Fitting
return void

KolmogorovSmirnovDistribution() public method

Creates a new Kolmogorov-Smirnov distribution.
public KolmogorovSmirnovDistribution ( [ samples ) : System
samples [ The number of samples.
return System

LogProbabilityDensityFunction() public method

Not supported.
public LogProbabilityDensityFunction ( double x ) : double
x double
return double

OneSideDistributionFunction() public method

Computes the Upper Tail of the P[Dn >= x] distribution.
This function approximates the upper tail of the P[Dn >= x] distribution using the one-sided Kolmogorov-Smirnov statistic.
public OneSideDistributionFunction ( double x ) : double
x double
return double

OneSideUpperTail() public static method

Computes the Upper Tail of the P[Dn >= x] distribution.
This function approximates the upper tail of the P[Dn >= x] distribution using the one-sided Kolmogorov-Smirnov statistic.
public static OneSideUpperTail ( double n, double x ) : double
n double
x double
return double

PelzGood() public static method

Pelz-Good algorithm for computing lower-tail areas of the Kolmogorov-Smirnov distribution.

As stated in Simard's paper, Pelz and Good (1976) generalized Kolmogorov's approximation to an asymptotic series in 1/sqrt(n).

References: Wolfgang Pelz and I. J. Good, "Approximating the Lower Tail-Areas of the Kolmogorov-Smirnov One-Sample Statistic", Journal of the Royal Statistical Society, Series B. Vol. 38, No. 2 (1976), pp. 152-156

public static PelzGood ( double n, double x ) : double
n double
x double
return double

Pomeranz() public static method

Pomeranz algorithm.
public static Pomeranz ( int n, double x ) : double
n int
x double
return double

ProbabilityDensityFunction() public method

Not supported.
public ProbabilityDensityFunction ( double x ) : double
x double
return double

ToString() public method

Returns a System.String that represents this instance.
public ToString ( string format, IFormatProvider formatProvider ) : string
format string
formatProvider IFormatProvider
return string