LinearModelTest_LinearModelAdjustedRSquared¶

LinearModelTest_LinearModelAdjustedRSquared
(*args)¶ Test the quality of the linear regression model Test.
Based on the adjusted indicator.
Available usages:
LinearModelTest.LinearModelAdjustedRSquared(firstSample, secondSample)
LinearModelTest.LinearModelAdjustedRSquared(firstSample, secondSample, level)
LinearModelTest.LinearModelAdjustedRSquared(firstSample, secondSample, linearModel)
LinearModelTest.LinearModelAdjustedRSquared(firstSample, secondSample, linearModel, level)
Parameters: fisrtSample : 2d sequence of float
First tested sample, of dimension 1.
secondSample : 2d sequence of float
Second tested sample, of dimension 1.
linearModel :
LinearModel
A linear model. If not provided, it is built using the given samples.
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.
See also
LinearModelTest_LinearModelRSquared
,LinearModelTest_LinearModelFisher
,LinearModelTest_LinearModelResidualMean
Notes
The LinearModelTest class is used through its static methods in order to evaluate the quality of the linear regression model between two samples (see
LinearModel
). The linear regression model between the scalar variable and the dimensional one is as follows:where is the residual, supposed to follow the standard Normal distribution.
The LinearModelAdjustedRSquared test checks the quality of the linear regression model. It evaluates the indicator adjusted (regression variance analysis) and compares it to a level.
Examples
>>> import openturns as ot >>> ot.RandomGenerator.SetSeed(0) >>> distribution = ot.Normal() >>> sample = distribution.getSample(30) >>> func = ot.NumericalMathFunction('x', '2 * x + 1') >>> firstSample = sample >>> secondSample = func(sample) + ot.Normal().getSample(30) >>> test_result = ot.LinearModelTest.LinearModelAdjustedRSquared(firstSample, secondSample) >>> print(test_result) class=TestResult name=Unnamed type=AdjustedRSquared binaryQualityMeasure=false pvalue threshold=0.95 pvalue=0.815998 description=[]