HypothesisTest_PartialPearson¶
-
HypothesisTest_PartialPearson
(firstSample, secondSample, selection, level=0.05)¶ Test whether two discrete samples are independent.
Available usages:
HypothesisTest.PartialPearson(firstSample, secondSample, selection)
HypothesisTest.PartialPearson(firstSample, secondSample, selection, level)
- Parameters
- firstSample2-d sequence of float
First tested sample, of dimension .
- secondSample2-d sequence of float
Second tested sample, of dimension 1.
- selectionsequence of integers, maximum integer value
List of indices selecting which subsets of the first sample will successively be tested with the second sample through the Pearson test.
- levelpositive float
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
Notes
The Partial Pearson Test is used to check the independence between two samples: firstSample of dimension n and secondSample of dimension 1. The parameter selection enables to select specific subsets of the firstSample to be tested.
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> distCol = [ot.Normal(), ot.Normal(), ot.Normal(), ot.Normal()] >>> S = ot.CorrelationMatrix(4) >>> S[0, 3] = 0.9 >>> copula = ot.NormalCopula(S) >>> distribution = ot.ComposedDistribution(distCol, copula) >>> sample = distribution.getSample(30) >>> firstSample = sample[:, :3] >>> secondSample = sample[:, 3] >>> test_result = ot.HypothesisTest.PartialPearson(firstSample, secondSample, [0, 2]) >>> print(test_result) [class=TestResult name=Unnamed type=Pearson binaryQualityMeasure=false p-value threshold=0.05 p-value=1.17002e-10 statistic=9.91178 description=[],class=TestResult name=Unnamed type=Pearson binaryQualityMeasure=true p-value threshold=0.05 p-value=0.19193 statistic=-1.33717 description=[]]