FullPearson

FullPearson(firstSample, secondSample, level=0.05)

Test whether two discrete samples are independent.

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:
testResultTestResultCollection

Collection of TestResult of size of size n.

See also

HypothesisTest.Pearson, HypothesisTest.PartialPearson

Notes

The Full Pearson Test is the independence Pearson test between 2 samples: firstSample of dimension n and secondSample of dimension 1. If firstSample[i] is the sample extracted from firstSample (i^{th} coordinate of each point of the sample), FullPearson performs the independence Pearson test simultaneously on firstSample[i] and secondSample. For all i, it is supposed that the couple (firstSample[i] and secondSample) is issued from a gaussian vector.

Examples

>>> import openturns as ot
>>> ot.RandomGenerator.SetSeed(0)
>>> distCol = [ot.Normal()] * 3
>>> S = ot.CorrelationMatrix(3)
>>> S[0, 2] = 0.9
>>> copula = ot.NormalCopula(S)
>>> distribution = ot.ComposedDistribution(distCol, copula)
>>> sample = distribution.getSample(30)
>>> firstSample = sample[:, :2]
>>> secondSample = sample[:, 2]
>>> test_result = ot.HypothesisTest.FullPearson(firstSample, secondSample)
>>> print(test_result)
[class=TestResult name=Unnamed type=Pearson binaryQualityMeasure=false p-value threshold=0.05 p-value=7.23...e-14 statistic=13.61 description=[],class=TestResult name=Unnamed type=Pearson binaryQualityMeasure=true p-value threshold=0.05 p-value=0.895124 statistic=-0.133027 description=[]]
>>> independent_samples = test_result[0].getBinaryQualityMeasure()