Tests whether the sample is compatible with the given distribution.

Namespace:  Meta.Numerics.Statistics
Assembly:  Meta.Numerics (in Meta.Numerics.dll) Version: 4.1.4
Syntax
```public static TestResult KolmogorovSmirnovTest(
ContinuousDistribution distribution
)```

#### Parameters

sample
The sample.
distribution
Type: Meta.Numerics.Statistics.DistributionsContinuousDistribution
The distribution.

#### Return Value

Type: TestResult
The test result. The test statistic is the D statistic and the probability is the chance of obtaining such a large value of D under the assumption that the sample is drawn from the given distribution.

#### Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IReadOnlyListDouble. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullExceptiondistribution is .
InsufficientDataExceptionThere is no data in the sample.
Remarks

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(Sample, Sample), allows you to non-parametrically test whether two samples are drawn from the same underlying distribution, without having to specify that distribution.