LinearModelTest_FullRegression(firstSample, secondSample, level=0.05)

Test whether two discrete samples are not linear.

Available usages:

LinearModelTest.FullRegression(firstSample, secondSample)

LinearModelTest.FullRegression(firstSample, secondSample, level)

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

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

testResultsCollection of TestResult

Results for each component of the linear model including intercept.


The Full 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. If firstSample[i] is the sample extracted from firstSample (i^{th} coordinate of each point of the sample), FullRegression performs the linear regression test on all firstSample[i] and secondSample. The linear regression test tests if the linear regression model between two scalar samples is not significant. It is based on the deviation analysis of the regression.


>>> 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]
>>> test_result = ot.LinearModelTest.FullRegression(firstSample, secondSample)
>>> print(test_result)
[class=TestResult name=Unnamed type=Regression binaryQualityMeasure=true p-value threshold=0.05 p-value=0.605 statistic=-0.52335 description=[],class=TestResult name=Unnamed type=Regression binaryQualityMeasure=false p-value threshold=0.05 p-value=9.70282e-27 statistic=44.256 description=[],class=TestResult name=Unnamed type=Regression binaryQualityMeasure=true p-value threshold=0.05 p-value=0.11352 statistic=1.63564 description=[]]