public void TwoSampleKolmogorovSmirnovTestConstructorTest()
{
Accord.Math.Tools.SetupGenerator(0);
// Create a K-S test to verify if two samples have been
// drawn from different populations. In this example, we
// will first generate a number of samples from different
// distributions, and then check if the K-S test can indeed
// see the difference:
// Generate 15 points from a Normal distribution with mean 5 and sigma 2
double[] sample1 = new NormalDistribution(mean: 5, stdDev: 1).Generate(50);
// Generate 15 points from an uniform distribution from 0 to 10
double[] sample2 = new UniformContinuousDistribution(a: 0, b: 10).Generate(50);
// Now we can create a K-S test and test the unequal hypothesis:
var test = new TwoSampleKolmogorovSmirnovTest(sample1, sample2,
TwoSampleKolmogorovSmirnovTestHypothesis.SamplesDistributionsAreUnequal);
bool significant = test.Significant; // outputs true
Assert.IsTrue(test.Significant);
Assert.AreEqual(0.4, test.Statistic, 1e-15);
Assert.IsFalse(Double.IsNaN(test.Statistic));
Assert.AreEqual(0.0004018, test.PValue, 1e-5);
}