public static TestResult KolmogorovSmirnovTest(
this IReadOnlyList<double> sample,
ContinuousDistribution distribution
)
<ExtensionAttribute>
Public Shared Function KolmogorovSmirnovTest (
sample As IReadOnlyList(Of Double),
distribution As ContinuousDistribution
) As TestResult
public:
[ExtensionAttribute]
static TestResult^ KolmogorovSmirnovTest(
IReadOnlyList<double>^ sample,
ContinuousDistribution^ distribution
)
[<ExtensionAttribute>]
static member KolmogorovSmirnovTest :
sample : IReadOnlyList<float> *
distribution : ContinuousDistribution -> TestResult
The null hypothesis of the Kolmogorov-Smirnov (KS) test is that the sample is drawn from the given continuous distribution. The test statistic D is the maximum deviation of the sample's empirical distribution function (EDF) from the distribution's cumulative distribution function (CDF). A high value of the test statistic, corresponding to a low right tail probability, indicates that the sample distribution disagrees with the given distribution to a degree unlikely to arise from statistical fluctuations.
For small sample sizes, we compute the null distribution of D exactly. For large sample sizes, we use an accurate asymptotic approximation. Therefore it is safe to use this method for all sample sizes.
A variant of this test, KolmogorovSmirnovTest(IReadOnlyListDouble, IReadOnlyListDouble), allows you to non-parametrically test whether two samples are drawn from the same underlying distribution, without having to specify that distribution.
Another variant of this test, KuiperTest(IReadOnlyListDouble, ContinuousDistribution), measures the deviation of EDF and CDF in a way that is invariant under re-definitions of the origin, and is thus particuarly appropriate for circular distributions.
ArgumentNullException | distribution is . |
InsufficientDataException | There is no data in the sample. |