HypothesisTest_ChiSquared

HypothesisTest_ChiSquared(firstSample, secondSample, level=0.95)

Test whether two discrete samples are independent.

Available usages:

HypothesisTest.ChiSquared(firstSample, secondSample)

HypothesisTest.ChiSquared(firstSample, secondSample, level)

Parameters:

fisrtSample : 2-d sequence of float

First tested sample, of dimension 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.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distCol = [ot.Normal(), ot.Normal()]
>>> distribution = ot.ComposedDistribution(distCol)
>>> sample = distribution.getSample(30)
>>> test_result = ot.HypothesisTest.ChiSquared(sample[:,0], sample[:,1])
>>> print(test_result)
class=TestResult name=Unnamed type=TwoSampleChiSquared binaryQualityMeasure=true p-value threshold=0.05 p-value=0.237197 description=[]