HypothesisTest_Smirnov(firstSample, secondSample, level=0.05)

Test whether two samples follows the same distribution.

Refer to Smirnov samples comparison test.

Available usages:

HypothesisTest.Smirnov(firstSample, secondSample)

HypothesisTest.Smirnov(firstSample, secondSample, level)

firstSample : 2-d sequence of float

First tested sample, of dimension n \geq 1.

secondSample : 2-d sequence of float

Second tested sample, of dimension 1.

level : positive float < 1

Threshold p-value of the test (= first kind risk), it must be < 1, equal to 0.05 by default.

testResult : TestResult

Structure containing the result of the test.


Smirnov’s test is a tool that may be used to compare two samples \{x_1, \ldots, x_N\} and \{x^{'}_1, \ldots, x^{'}_M\} (of sizes not necessarily equal). The goal is to determine whether these two samples come from the same probability distribution or not. If this is the case, the two samples should be aggregated in order to increase the robustness of further statistical analysis.


>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distCol = [ot.Normal(), ot.Normal()]
>>> firstSample = ot.Normal().getSample(30)
>>> secondSample = ot.Normal().getSample(30)
>>> test_result = ot.HypothesisTest.Smirnov(firstSample, secondSample)
>>> print(test_result)
class=TestResult name=Unnamed type=TwoSampleSmirnov binaryQualityMeasure=true p-value threshold=0.05 p-value=0.807963 description=[]