SuanShu, a Java numerical and statistical library

com.numericalmethod.suanshu.stats.test.distribution.kolmogorov
Class KolmogorovSmirnov

java.lang.Object
  extended by com.numericalmethod.suanshu.stats.test.HypothesisTest
      extended by com.numericalmethod.suanshu.stats.test.distribution.kolmogorov.KolmogorovSmirnov
Direct Known Subclasses:
KolmogorovSmirnov1Sample, KolmogorovSmirnov2Samples

public class KolmogorovSmirnov
extends HypothesisTest

The Kolmogorov–Smirnov test (KS test) is used to compare a sample with a reference probability distribution (one-sample KS test), or to compare two samples (two-sample KS test).

The Kolmogorov–Smirnov statistic quantifies a distance between the empirical distribution function of the sample and the cumulative distribution function of the reference distribution (one-sample KS test), or between the empirical distribution functions of two samples (two-sample KS test).

The null distribution of this statistic is calculated under the null hypothesis that the sample is drawn from the reference distribution (in the one-sample case), or that the samples are drawn from the same distribution (in the two-sample case)

In each case, the distributions considered under the null hypothesis are continuous distributions but are otherwise unrestricted.

The test-statistics is either Dn, Dn+, or Dn-, depending on the side to compute

By R convention, when exact p-values are not available, we use limiting distribution. Exact p-values are not available in the case of ties for one-sample case.

The R equivalent function is ks.test.

See Also:

Nested Class Summary
static class KolmogorovSmirnov.Side
          the type of Kolmogorov-Smirnov statistic available
static class KolmogorovSmirnov.Type
          the types of Kolmogorov-Smirnov tests available
 
Field Summary
 KolmogorovSmirnov.Side side
          the type of Kolmogorov-Smirnov statistic to be computed
 KolmogorovSmirnov.Type type
          the type of Kolmogorov-Smirnov test to be performed
 
Fields inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest
k, N, pValue, testStatistics
 
Method Summary
 java.lang.String alternativeHypothesis()
          Get a description of the alternative hypothesis.
 java.lang.String nullHypothesis()
          Get a description of the null hypothesis.
 
Methods inherited from class com.numericalmethod.suanshu.stats.test.HypothesisTest
oneSidedPvalue, pValue, rejectNull, testStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

public final KolmogorovSmirnov.Type type
the type of Kolmogorov-Smirnov test to be performed


side

public final KolmogorovSmirnov.Side side
the type of Kolmogorov-Smirnov statistic to be computed

Method Detail

nullHypothesis

public java.lang.String nullHypothesis()
Description copied from class: HypothesisTest
Get a description of the null hypothesis.

Specified by:
nullHypothesis in class HypothesisTest
Returns:
the null hypothesis description
See Also:
Wikipedia: Null hypothesis

alternativeHypothesis

public java.lang.String alternativeHypothesis()
Description copied from class: HypothesisTest
Get a description of the alternative hypothesis.

Specified by:
alternativeHypothesis in class HypothesisTest
Returns:
the alternative hypothesis description
See Also:
Wikipedia: Alternative hypothesis

SuanShu, a Java numerical and statistical library

Copyright © 2011 Numerical Method Inc. Ltd. All Rights Reserved.