Spearman

Spearman(firstSample, secondSample, level=0.05)

Test whether two samples have no rank correlation.

Refer to Spearman correlation test.

Parameters:
firstSample2-d sequence of float

First tested sample, of dimension n \geq 1.

secondSample2-d sequence of float

Second tested sample, of dimension 1.

levelpositive float < 1, optional

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

Returns:
testResultTestResult

Structure containing the result of the test.

See also

HypothesisTest.Pearson

Notes

The Spearman Test is used to check whether two samples of dimension 1 have no rank correlation.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distribution = ot.Normal()
>>> firstSample = distribution.getSample(30)
>>> func = ot.SymbolicFunction(['x'], ['x^2'])
>>> secondSample = func(firstSample)
>>> test_result = ot.HypothesisTest.Spearman(firstSample, secondSample)
>>> print(test_result)
class=TestResult name=Unnamed type=Spearman binaryQualityMeasure=true p-value threshold=0.05 p-value=0.442067 statistic=-0.774521 description=[]
>>> no_rank_correlation = test_result.getBinaryQualityMeasure()