HypothesisTest_Smirnov

HypothesisTest_Smirnov(firstSample, secondSample, level=0.95)

Test whether two samples follows the same distribution.

Available usages:

HypothesisTest.Smirnov(firstSample, secondSample)

HypothesisTest.Smirnov(firstSample, secondSample, level)

Parameters:

fisrtSample : 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 (= 1 - first type risk), it must be < 1, equal to 0.95 by default.

Returns:

testResult : TestResult

Structure containing the result of the test.

Notes

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.

Examples

>>> 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=[]