TwoSamplesKolmogorov¶
- TwoSamplesKolmogorov(sample1, sample2, level=0.05)¶
Test whether two samples follows the same distribution.
If the p-value is high, then we cannot reject the hypothesis that the distributions of the two samples are the same.
- Parameters:
- sample12-d float array
A continuous distribution sample.
- sample22-d float array
Another continuous distribution sample, can be of different size.
- levelfloat, , optional
This is the risk of committing a Type I error, that is an incorrect rejection of a true null hypothesis. Default value is 0.05
- Returns:
- test_result
TestResult
Test result.
- test_result
Notes
This statistical test might be used to compare two samples and (of sizes not necessarily equal). The goal is to determine whether these two samples come from the same probability distribution or not. (without any information of the underlying distribution under the null hypothesis)
As application, if null hypothesis could not be rejected, the two samples could be be aggregated in order to increase the robustness of further statistical analysis.
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> sample1 = ot.Normal().getSample(20) >>> sample2 = ot.Normal(0.1, 1.1).getSample(30) >>> test_result = ot.HypothesisTest.TwoSamplesKolmogorov(sample1, sample2) >>> print(test_result) class=TestResult name=Unnamed type=TwoSamplesKolmogorov binaryQualityMeasure=true p-value threshold=0.05 p-value=0.554765 statistic=0.216667 description=[sampleNormal vs sample Normal] >>> same_distribution = test_result.getBinaryQualityMeasure()