HypothesisTest_PartialRegression¶

HypothesisTest_PartialRegression
(firstSample, secondSample, selection, level=0.95)¶ Test whether two discrete samples are independent.
Available usages:
HypothesisTest.PartialRegression(firstSample, secondSample, selection)
HypothesisTest.PartialRegression(firstSample, secondSample, selection, level)
Parameters: fisrtSample : 2d sequence of float
First tested sample, of dimension .
secondSample : 2d sequence of float
Second tested sample, of dimension 1.
selection : sequence of int, maximum integer value
List of indices selecting which subsets of the first sample will successively be tested with the second sample through the regression test.
level : positive float
Threshold pvalue of the test (= 1  first type risk), it must be , equal to 0.95 by default.
Returns: testResult :
TestResult
Structure containing the result of the test.
Notes
The Partial Regression Test is used to check the quality of the linear regression model 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) >>> dim = 3 >>> distCol = [ot.Normal()] * dim >>> S = ot.CorrelationMatrix(dim) >>> S[0, dim  1] = 0.99 >>> copula = ot.NormalCopula(S) >>> distribution = ot.ComposedDistribution(distCol, copula) >>> sample = distribution.getSample(30) >>> firstSample = sample[:, :2] >>> secondSample = sample[:, 2] >>> selection = [1] >>> test_result = ot.HypothesisTest.PartialRegression(firstSample, secondSample, selection) >>> print(test_result) [class=TestResult name=Unnamed type=Regression binaryQualityMeasure=true pvalue threshold=0.05 pvalue=0.579638 description=[]]