Pearson¶
- Pearson(firstSample, secondSample, level=0.05)¶
Test whether two discrete samples are independent.
Refer to Pearson’s correlation test.
- Parameters:
- firstSample2-d sequence of float
First tested sample, of dimension .
- secondSample2-d sequence of float
Second tested sample, of dimension 1.
- levelpositive float , optional
Threshold p-value of the test (= first kind risk), it must be , equal to 0.05 by default.
- Returns:
- testResult
TestResult
Structure containing the result of the test.
- testResult
See also
Notes
The Pearson Test is used to check whether two samples which are assumed to form a gaussian vector are independent (based on the evaluation of the linear correlation coefficient).
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.Pearson(firstSample, secondSample) >>> print(test_result) class=TestResult name=Unnamed type=Pearson binaryQualityMeasure=true p-value threshold=0.05 p-value=0.984737 statistic=0.019302 description=[] >>> independent_samples = test_result.getBinaryQualityMeasure()
Examples using the function¶
Test independence